// SyncProgress retrieves the current progress of the sync algorithm. If there's
// no sync currently running, it returns nil.
175964
func (ec *EthereumClient) SyncProgress(ctx *Context) (progress *SyncProgress, _ error) {
	rawProgress, err := ec.client.SyncProgress(ctx.context)
	if rawProgress == nil {
		return nil, err
	}
	return &SyncProgress{*rawProgress}, err
}
1106667
func (job *QorJob) SetProgress(progress uint) error {
	job.mutex.Lock()
	defer job.mutex.Unlock()

	if progress > 100 {
		progress = 100
	}
	job.Progress = progress

	if job.shouldCallSave() {
		return job.callSave()
	}

	return nil
}
454939
func (mp *MultiProgressBar) AddProgressBar(p *ProgressBar) {
	mp.ProgressBars = append(mp.ProgressBars, p)

	if len(mp.ProgressBars) > 1 {
		fmt.Println()
	}
	mp.Print()
}
1001064
func (s *Backup) SetProgressPercent(v int64) *Backup {
	s.ProgressPercent = &v
	return s
}
190991
func (s *MigrationTask) SetProgressUpdateStream(v string) *MigrationTask {
	s.ProgressUpdateStream = &v
	return s
}
514232
func (si *shareImporter) serveProgress(w http.ResponseWriter, r *http.Request) {
	si.mu.RLock()
	defer si.mu.RUnlock()
	httputil.ReturnJSON(w, camtypes.ShareImportProgress{
		FilesSeen:   si.seen,
		FilesCopied: si.copied,
		Running:     si.running,
		Assembled:   si.assembled,
		BlobRef:     si.br,
	})
}
1032043
func SimpleProgress(printChar string, tickInterval time.Duration, action func()) {
	// run async
	finishedChan := make(chan bool)

	go func() {
		action()
		finishedChan <- true
	}()

	isRunFinished := false
	for !isRunFinished {
		select {
		case <-finishedChan:
			isRunFinished = true
		case <-time.Tick(tickInterval):
			fmt.Print(printChar)
		}
	}
	fmt.Println()
}
270065
func NewProgressOutput(out io.Writer) progress.Output {
	return &progressOutput{sf: &rawProgressFormatter{}, out: out, newLines: true}
}
797776
func (l *Lease) Progress(ctx context.Context, percent int32) error {
	req := types.HttpNfcLeaseProgress{
		This:    l.Reference(),
		Percent: percent,
	}

	_, err := methods.HttpNfcLeaseProgress(ctx, l.c, &req)
	if err != nil {
		return err
	}

	return nil
}
366855
func (s *ListCreatedArtifactsInput) SetProgressUpdateStream(v string) *ListCreatedArtifactsInput {
	s.ProgressUpdateStream = &v
	return s
}
614866
func (shardSwap *shardSchemaSwap) markPropagationInProgress() {
	shardSwap.propagationUINode.Message = ""
	shardSwap.propagationUINode.State = workflowpb.WorkflowState_Running
	shardSwap.propagationUINode.Display = workflow.NodeDisplayDeterminate
	shardSwap.propagationUINode.BroadcastChanges(false /* updateChildren */)
}
1335163
func (proxier *Proxier) SyncLoop() {
	// Update healthz timestamp at beginning in case Sync() never succeeds.
	if proxier.healthzServer != nil {
		proxier.healthzServer.UpdateTimestamp()
	}
	proxier.syncRunner.Loop(wait.NeverStop)
}
1264538
func (c *ProgressBar) SetProgress(p int) {
	if (p <= c.total || c.allowOverflow) || (p >= 0 || c.allowUnderflow) {
		c.progress = p
	}
}
1018469
func (cpb *ProgressBar) TrackProgress(src string, currentSize, totalSize int64, stream io.ReadCloser) io.ReadCloser {
	cpb.lock.Lock()
	defer cpb.lock.Unlock()

	newPb := pb.New64(totalSize)
	newPb.Set64(currentSize)
	ProgressBarConfig(newPb, filepath.Base(src))
	if cpb.pool == nil {
		cpb.pool = pb.NewPool()
		cpb.pool.Start()
	}
	cpb.pool.Add(newPb)
	reader := newPb.NewProxyReader(stream)

	cpb.pbs++
	return &readCloser{
		Reader: reader,
		close: func() error {
			cpb.lock.Lock()
			defer cpb.lock.Unlock()

			newPb.Finish()
			cpb.pbs--
			if cpb.pbs <= 0 {
				cpb.pool.Stop()
				cpb.pool = nil
			}
			return nil
		},
	}
}
317397
func NewProgressFileReader(file string) (*ProgressReader, <-chan Progress, error) {
	f, ferr := os.Open(file)
	if ferr != nil {
		return nil, nil, ferr
	}
	// Get the filesize by seeking to the end of the file, and back to offset 0
	fsize, err := f.Seek(0, os.SEEK_END)
	if err != nil {
		return nil, nil, err
	}
	if _, err := f.Seek(0, os.SEEK_SET); err != nil {
		return nil, nil, err
	}
	io, ch := NewProgressReader(f, fsize)
	return io, ch, nil
}
276626
func GetProgressCallback(ctx context.Context) ProgressCallback {
	cb, ok := ctx.Value(ctxKeyProgressCallback).(ProgressCallback)
	if !ok || cb == nil {
		return func() {}
	}
	return cb
}
398130
func (s *MigrationTaskSummary) SetProgressPercent(v int64) *MigrationTaskSummary {
	s.ProgressPercent = &v
	return s
}