// GetNewState returns the new state from the alert rule evaluation
970382
func (c *EvalContext) GetNewState() m.AlertStateType {
	ns := getNewStateInternal(c)
	if ns != m.AlertStateAlerting || c.Rule.For == 0 {
		return ns
	}

	since := time.Since(c.Rule.LastStateChange)
	if c.PrevAlertState == m.AlertStatePending && since > c.Rule.For {
		return m.AlertStateAlerting
	}

	if c.PrevAlertState == m.AlertStateAlerting {
		return m.AlertStateAlerting
	}

	return m.AlertStatePending
}
656534
func (tsv *TabletServer) GetState() string {
	if tsv.lameduck.Get() != 0 {
		return "NOT_SERVING"
	}
	tsv.mu.Lock()
	name := stateName[tsv.state]
	tsv.mu.Unlock()
	return name
}
243422
func NewState(caller base.APICaller) *State {
	facadeCaller := base.NewFacadeCaller(caller, provisionerFacade)
	return NewStateFromFacade(facadeCaller)
}
767156
func (vm *VM) GetState() (string, error) {
	if vm.MockGetState != nil {
		return vm.MockGetState()
	}
	return "", lvm.ErrNotImplemented
}
547445
func NewState(
	caller base.APICaller,
	authTag names.UnitTag,
) *State {
	facadeCaller := base.NewFacadeCaller(
		caller,
		uniterFacade,
	)
	state := &State{
		ModelWatcher:     common.NewModelWatcher(facadeCaller),
		APIAddresser:     common.NewAPIAddresser(facadeCaller),
		UpgradeSeriesAPI: common.NewUpgradeSeriesAPI(facadeCaller, authTag),
		StorageAccessor:  NewStorageAccessor(facadeCaller),
		facade:           facadeCaller,
		unitTag:          authTag,
	}

	newWatcher := func(result params.NotifyWatchResult) watcher.NotifyWatcher {
		return apiwatcher.NewNotifyWatcher(caller, result)
	}
	state.LeadershipSettings = NewLeadershipSettingsAccessor(
		facadeCaller.FacadeCall,
		newWatcher,
		ErrIfNotVersionFn(2, state.BestAPIVersion()),
	)
	return state
}
290854
func (v *VersioningTestV2) GetNewstruct() (o *Bonk) {
	if v != nil && v.Newstruct != nil {
		return v.Newstruct
	}

	return
}
143620
func (b *Backend) GetState(taskUUID string) (*tasks.TaskState, error) {
	tasktStateBytes, ok := b.tasks[taskUUID]
	if !ok {
		return nil, NewErrTasknotFound(taskUUID)
	}

	state := new(tasks.TaskState)
	decoder := json.NewDecoder(bytes.NewReader(tasktStateBytes))
	decoder.UseNumber()
	if err := decoder.Decode(state); err != nil {
		return nil, fmt.Errorf("Failed to unmarshal task state %v", b)
	}

	return state, nil
}
1114535
func (p *MemoryLedger) GetState(namespace string, key string) ([]byte, error) {
	value := p.entries[key]

	return value, nil
}
1246887
func (u *UserMigration) GetState() string {
	if u == nil || u.State == nil {
		return ""
	}
	return *u.State
}
694701
func NewState(caller base.APICaller) (*State, error) {
	facadeCaller := base.NewFacadeCaller(caller, storageProvisionerFacade)
	return &State{facadeCaller}, nil
}
1056351
func NewGetProcedureState(ctx context.Context, procID uint64) *GetProcedureState {
	return &GetProcedureState{
		base: base{
			ctx:      ctx,
			resultch: make(chan RPCResult, 1),
		},
		procID: procID,
	}
}
35952
func (e *Endpoint) GetState() string {
	e.UnconditionalRLock()
	defer e.RUnlock()
	return e.GetStateLocked()
}
279583
func (ps *PeerState) GetRoundState() *cstypes.PeerRoundState {
	ps.mtx.Lock()
	defer ps.mtx.Unlock()

	prs := ps.PRS // copy
	return &prs
}
519470
func (asyncResult *AsyncResult) GetState() *tasks.TaskState {
	if asyncResult.taskState.IsCompleted() {
		return asyncResult.taskState
	}

	taskState, err := asyncResult.backend.GetState(asyncResult.Signature.UUID)
	if err == nil {
		asyncResult.taskState = taskState
	}

	return asyncResult.taskState
}
1167338
func (s *SeriesCollection) getState(alloc bool) *seriesCollectionState {
	addr := (*unsafe.Pointer)(unsafe.Pointer(&s.state))

	// fast path: load pointer and it already exists. always return the result if we can't alloc.
	if ptr := atomic.LoadPointer(addr); ptr != nil || !alloc {
		return (*seriesCollectionState)(ptr)
	}

	// nothing there. make a new state and try to swap it in.
	atomic.CompareAndSwapPointer(addr, nil, unsafe.Pointer(new(seriesCollectionState)))

	// reload the pointer. this way we always end up with the winner of the race.
	return (*seriesCollectionState)(atomic.LoadPointer(addr))
}
46615
func NewGetStatus(ctx *middleware.Context, handler GetStatusHandler) *GetStatus {
	return &GetStatus{Context: ctx, Handler: handler}
}
3557
func newEvalState() *evalState {
	return &evalState{
		status: structs.EvalStatusPending,
		allocs: make(map[string]*allocState),
	}
}