// GetDebugState is part of Manager interface.
194193
func (m TaskManager) GetDebugState(c context.Context, ctl task.ControllerReadOnly) (*internal.DebugManagerState, error) {
	cfg := ctl.Task().(*messages.GitilesTask)
	g, err := m.getGitilesClient(c, ctl, cfg)
	if err != nil {
		return nil, err
	}

	refs, err := m.fetchRefsState(c, ctl, cfg, g)
	if err != nil {
		ctl.DebugLog("Error fetching state of the world: %s", err)
		return nil, err
	}

	sortedRefs := func(refs map[string]string) []*pb.DebugState_Ref {
		keys := make([]string, 0, len(refs))
		for k := range refs {
			keys = append(keys, k)
		}
		sort.Strings(keys)
		out := make([]*pb.DebugState_Ref, len(refs))
		for i, key := range keys {
			out[i] = &pb.DebugState_Ref{Ref: key, Commit: refs[key]}
		}
		return out
	}

	return &internal.DebugManagerState{
		GitilesPoller: &pb.DebugState{
			Known:   sortedRefs(refs.known),
			Current: sortedRefs(refs.current),
		},
	}, nil
}
91861
func GetState() (HealthState, time.Time, time.Time) {
	mutex.RLock()
	defer mutex.RUnlock()

	hs := make(HealthState)
	for key := range healthState {
		hs[key] = healthState[key]
	}

	return hs, healthLastChecked, healthLastSuccess
}
356491
func getDumpState(dumpContext *resources.DumpOperation) *dumpState {
	if dumpContext.CloudState == nil {
		dumpContext.CloudState = &dumpState{
			cloud: dumpContext.Cloud.(awsup.AWSCloud),
		}
	}
	return dumpContext.CloudState.(*dumpState)
}
1142329
func (m *systemdUnitManager) GetUnitState(name string) (*unit.UnitState, error) {
	m.mutex.Lock()
	defer m.mutex.Unlock()
	us, err := m.getUnitState(name)
	if err != nil {
		return nil, err
	}
	if h, ok := m.hashes[name]; ok {
		us.UnitHash = h.String()
	}
	return us, nil
}
677249
func (rp *Ringpop) getState() state {
	rp.stateMutex.RLock()
	r := rp.state
	rp.stateMutex.RUnlock()
	return r
}
926574
func (d *Driver) GetState() (state.State, error) {
	if err := d.verifyRootPermissions(); err != nil {
		return state.Error, err
	}

	pid := d.getPid()
	log.Debugf("hyperkit pid from json: %d", pid)
	return pidState(pid)
}
746866
func (p *PullRequestReview) GetState() string {
	if p == nil || p.State == nil {
		return ""
	}
	return *p.State
}
681898
func IsDebug(ctx context.Context) bool {
	bv, ok := ctx.Value(ctxKeyDebug).(bool)
	if !ok {
		return false
	}
	return bv
}
343007
func GetDebugInfo() (*DebugInfo, error) {
	h, err := windows.GetCurrentProcess()
	if err != nil {
		return nil, err
	}

	var token syscall.Token
	err = syscall.OpenProcessToken(syscall.Handle(h), syscall.TOKEN_QUERY, &token)
	if err != nil {
		return nil, err
	}

	privs, err := GetTokenPrivileges(token)
	if err != nil {
		return nil, err
	}

	user, err := GetTokenUser(token)
	if err != nil {
		return nil, err
	}

	return &DebugInfo{
		User:         user,
		ProcessPrivs: privs,
		OSVersion:    GetWindowsVersion(),
		Arch:         runtime.GOARCH,
		NumCPU:       runtime.NumCPU(),
	}, nil
}
475056
func (stub *ChaincodeStub) GetState(key string) ([]byte, error) {
	// Access public data by setting the collection to empty string
	collection := ""
	return stub.handler.handleGetState(collection, key, stub.ChannelId, stub.TxID)
}
837127
func (r *RepoStatus) GetState() string {
	if r == nil || r.State == nil {
		return ""
	}
	return *r.State
}
91755
func (d *Daemon) CheckServiceUpdateState(service string) func(*check.C) (interface{}, check.CommentInterface) {
	return func(c *check.C) (interface{}, check.CommentInterface) {
		service := d.GetService(c, service)
		if service.UpdateStatus == nil {
			return "", nil
		}
		return service.UpdateStatus.State, nil
	}
}
294817
func (s *adminServer) GetDebugJobState(c context.Context, r *schedulerpb.JobRef) (resp *internal.DebugJobState, err error) {
	switch state, err := s.Engine.GetDebugJobState(c, r.Project+"/"+r.Job); {
	case err == engine.ErrNoSuchJob:
		return nil, status.Errorf(codes.NotFound, "no such job")
	case err != nil:
		return nil, err
	default:
		return &internal.DebugJobState{
			Enabled:    state.Job.Enabled,
			Paused:     state.Job.Paused,
			LastTriage: google.NewTimestamp(state.Job.LastTriage),
			CronState: &internal.DebugJobState_CronState{
				Enabled:       state.Job.Cron.Enabled,
				Generation:    state.Job.Cron.Generation,
				LastRewind:    google.NewTimestamp(state.Job.Cron.LastRewind),
				LastTickWhen:  google.NewTimestamp(state.Job.Cron.LastTick.When),
				LastTickNonce: state.Job.Cron.LastTick.TickNonce,
			},
			ManagerState:        state.ManagerState,
			ActiveInvocations:   state.Job.ActiveInvocations,
			FinishedInvocations: state.FinishedInvocations,
			RecentlyFinishedSet: state.RecentlyFinishedSet,
			PendingTriggersSet:  state.PendingTriggersSet,
		}, nil
	}
}
829487
func (f *Fetcher) Debug() <-chan *DebugInfo {
	f.dbgmu.Lock()
	defer f.dbgmu.Unlock()
	f.debugging = true
	return f.dbg
}
1045827
func (b *HttpRequest) Debug(isdebug bool) *HttpRequest {
	b.setting.ShowDebug = isdebug
	return b
}
362520
func GetStateResourceManager() (*StateResourceManager, error) {
	if gStateResourceManager == nil {
		return nil, core.Errorf("state-based resource manager has not been not created.")
	}

	return gStateResourceManager, nil
}
961108
func (vm *VM) GetState() (string, error) {

	if vm.ID == "" {
		return "", fmt.Errorf("Need an ID to get virtual machine state")
	}

	if err := vm.updateInfo(); err != nil {
		return "", err
	}

	return vm.state, nil
}