// IsRemovalInProgress returns whether the RemovalInProgress flag is set.
// Used by Container to check whether a container is being removed.
484164
func (s *State) IsRemovalInProgress() bool {
	s.Lock()
	res := s.RemovalInProgress
	s.Unlock()
	return res
}
341410
func IsMigrationActive(st *State, modelUUID string) (bool, error) {
	active, closer := st.db().GetCollection(migrationsActiveC)
	defer closer()
	n, err := active.FindId(modelUUID).Count()
	if err != nil {
		return false, errors.Trace(err)
	}
	return n > 0, nil
}
35315
func (ec *Client) SyncProgress(ctx context.Context) (*ethereum.SyncProgress, error) {
	var raw json.RawMessage
	if err := ec.c.CallContext(ctx, &raw, "eth_syncing"); err != nil {
		return nil, err
	}
	// Handle the possible response types
	var syncing bool
	if err := json.Unmarshal(raw, &syncing); err == nil {
		return nil, nil // Not syncing (always false)
	}
	var progress *rpcProgress
	if err := json.Unmarshal(raw, &progress); err != nil {
		return nil, err
	}
	return &ethereum.SyncProgress{
		StartingBlock: uint64(progress.StartingBlock),
		CurrentBlock:  uint64(progress.CurrentBlock),
		HighestBlock:  uint64(progress.HighestBlock),
		PulledStates:  uint64(progress.PulledStates),
		KnownStates:   uint64(progress.KnownStates),
	}, nil
}
435709
func (s *CachediSCSIVolume) SetVolumeProgress(v float64) *CachediSCSIVolume {
	s.VolumeProgress = &v
	return s
}
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
		},
	}
}
276626
func GetProgressCallback(ctx context.Context) ProgressCallback {
	cb, ok := ctx.Value(ctxKeyProgressCallback).(ProgressCallback)
	if !ok || cb == nil {
		return func() {}
	}
	return cb
}
2592
func (c *Consumer) ProgressLabel(label string) {
	if c != nil && c.OnProgressLabel != nil {
		c.OnProgressLabel(label)
	}
}
149126
func (v VMwareLease) Progress(p int) {
	v.Lease.Progress(v.Ctx, int32(p))
}
398130
func (s *MigrationTaskSummary) SetProgressPercent(v int64) *MigrationTaskSummary {
	s.ProgressPercent = &v
	return s
}
744016
func (s *DiskSnapshot) SetProgress(v string) *DiskSnapshot {
	s.Progress = &v
	return s
}
757182
func IsUpgradeInProgressError(err error) bool {
	if state.IsUpgradeInProgressError(err) {
		return true
	}
	return errors.Cause(err) == params.UpgradeInProgressError
}
789964
func (el *eventLogger) EventBegin(ctx context.Context, event string, metadata ...Loggable) *EventInProgress {
	ctx = el.Start(ctx, event)

	for _, m := range metadata {
		for l, v := range m.Loggable() {
			el.LogKV(ctx, l, v)
		}
	}

	eip := &EventInProgress{}
	eip.doneFunc = func(additional []Loggable) {
		// anything added during the operation
		// e.g. deprecated methods event.Append(...) or event.SetError(...)
		for _, m := range eip.loggables {
			for l, v := range m.Loggable() {
				el.LogKV(ctx, l, v)
			}
		}
		el.Finish(ctx)
	}
	return eip
}
569006
func Progress() {
	fpsTimerContainer.Range(func(_, v interface{}) bool {
		fps := v.(*fps)
		if id, fired := fps.progress(); fired {
			fpsTimerContainer.Delete(id)
		}
		return true
	})
}
977274
func (c *Callbacks) OnCDOTAUserMsg_HeroRelicProgress(fn func(*dota.CDOTAUserMsg_HeroRelicProgress) error) {
	c.onCDOTAUserMsg_HeroRelicProgress = append(c.onCDOTAUserMsg_HeroRelicProgress, fn)
}
835101
func (p *InProgress) GetProgress() (bool, string, string, error) {
	p.locker.RLock()
	defer p.locker.RUnlock()
	return p.running, p.filename, p.op, p.err
}
1123049
func (s *Tape) SetProgress(v float64) *Tape {
	s.Progress = &v
	return s
}
1268937
func (m *Machine) MarkForRemoval() (err error) {
	defer errors.DeferredAnnotatef(&err, "cannot remove machine %s", m.doc.Id)
	// Local variable so we can refresh the machine if needed.
	machine := m
	buildTxn := func(attempt int) ([]txn.Op, error) {
		if attempt != 0 {
			if machine, err = machine.st.Machine(machine.Id()); err != nil {
				return nil, errors.Trace(err)
			}
		}
		ops, err := machine.markForRemovalOps()
		if err != nil {
			return nil, errors.Trace(err)
		}
		return ops, nil
	}
	return m.st.db().Run(buildTxn)
}