// getStatesCmd returns a command to get states.
19543
func getStatesCmd(params *Parameters) *subcommands.Command {
	return &subcommands.Command{
		UsageLine: "get-states [-prefix <prefix>]",
		ShortDesc: "retrieves states",
		LongDesc:  "Retrieves the state matching the given prefix, or all states if prefix is omitted.\n\nExample:\ncrimson get-states",
		CommandRun: func() subcommands.CommandRun {
			cmd := &GetStatesCmd{}
			cmd.Initialize(params)
			cmd.Flags.StringVar(&cmd.prefix, "prefix", "", "Prefix to get the matching state for.")
			return cmd
		},
	}
}
998825
func (c *Client) GetState() uint8 {
	c.stateLock.Lock()
	defer c.stateLock.Unlock()

	return c.state.State()
}
199350
func (d *Domain) GetState() (DomainState, int, error) {
	var cState C.int
	var cReason C.int
	var err C.virError
	result := C.virDomainGetStateWrapper(d.ptr,
		(*C.int)(unsafe.Pointer(&cState)),
		(*C.int)(unsafe.Pointer(&cReason)),
		0, &err)
	if int(result) == -1 {
		return 0, 0, makeError(&err)
	}
	return DomainState(cState), int(cReason), nil
}
746866
func (p *PullRequestReview) GetState() string {
	if p == nil || p.State == nil {
		return ""
	}
	return *p.State
}
233562
func (qe *UpdateBatchBackedQueryExecuter) GetState(ns, key string) (*statedb.VersionedValue, error) {
	return qe.UpdateBatch.Get(ns, key), nil
}
530474
func (p *PullRequest) GetState() string {
	if p == nil || p.State == nil {
		return ""
	}
	return *p.State
}
767156
func (vm *VM) GetState() (string, error) {
	if vm.MockGetState != nil {
		return vm.MockGetState()
	}
	return "", lvm.ErrNotImplemented
}
1246887
func (u *UserMigration) GetState() string {
	if u == nil || u.State == nil {
		return ""
	}
	return *u.State
}
911458
func (o *PooledObject) GetState() PooledObjectState {
	o.lock.Lock()
	defer o.lock.Unlock()
	return o.state
}
998265
func (c *Client) GetStateFromCluster() (*State, error) {
	resp, err := c.GetHTTPResponseFromCluster(c.GetURLForStateFile)
	return c.parseStateResponse(resp, err)
}
404513
func (b *Backend) GetState(taskUUID string) (*tasks.TaskState, error) {
	state := &tasks.TaskState{}
	err := b.tasksCollection.FindOne(context.Background(), bson.M{"_id": taskUUID}).Decode(state)

	if err != nil {
		return nil, err
	}
	return state, nil
}
677249
func (rp *Ringpop) getState() state {
	rp.stateMutex.RLock()
	r := rp.state
	rp.stateMutex.RUnlock()
	return r
}
220944
func (cs *StarterClient) GetCheServerState(ctx context.Context) (*ServerStateResponse, error) {
	req, err := http.NewRequest("GET", cs.targetURL("server"), nil)

	if err != nil {
		return nil, err
	}

	cs.setHeaders(ctx, req)

	if log.IsDebug() {
		b, _ := httputil.DumpRequest(req, true)
		log.Debug(ctx, map[string]interface{}{
			"request": string(b),
		}, "dump of the request to get the che server state")
	}

	resp, err := cs.client.Do(req)

	if err != nil {
		return nil, err
	}

	defer rest.CloseResponse(resp)

	if resp.StatusCode != http.StatusCreated && resp.StatusCode != http.StatusOK {
		statusErr := StarterError{}
		err = json.NewDecoder(resp.Body).Decode(&statusErr)
		if err != nil {
			log.Error(ctx, map[string]interface{}{
				"err": err,
			}, "failed to decode error response from get che server state")
			return nil, err
		}
		log.Error(ctx, map[string]interface{}{
			"err": statusErr.String(),
		}, "failed to execute get che server state")
		return nil, &statusErr
	}

	cheServerStateResponse := ServerStateResponse{}
	err = json.NewDecoder(resp.Body).Decode(&cheServerStateResponse)
	if err != nil {
		log.Error(ctx, map[string]interface{}{
			"err": err,
		}, "failed to decode response from getting che server state")
		return nil, err
	}
	return &cheServerStateResponse, nil
}
1055430
func (vdb *VersionedDB) GetState(namespace string, key string) (*statedb.VersionedValue, error) {
	logger.Debugf("GetState(). ns=%s, key=%s", namespace, key)
	if namespace == "lscc" {
		if value := vdb.lsccStateCache.getState(key); value != nil {
			return value, nil
		}
	}

	db, err := vdb.getNamespaceDBHandle(namespace)
	if err != nil {
		return nil, err
	}
	couchDoc, _, err := db.ReadDoc(key)
	if err != nil {
		return nil, err
	}
	if couchDoc == nil {
		return nil, nil
	}
	kv, err := couchDocToKeyValue(couchDoc)
	if err != nil {
		return nil, err
	}

	if namespace == "lscc" {
		vdb.lsccStateCache.setState(key, kv.VersionedValue)
	}

	return kv.VersionedValue, nil
}
521343
func (vm *VM) GetState() (string, error) {
	stdout, err := runner.RunCombinedError("showvminfo", vm.Name)
	if err != nil {
		return "", lvm.WrapErrors(lvm.ErrVMInfoFailed, err)
	}
	for _, line := range strings.Split(stdout, "\n") {
		// See if this is a NIC
		if match := stateRegexp.FindStringSubmatch(line); match != nil {
			if match := runningRegexp.FindStringSubmatch(line); match != nil {
				return lvm.VMRunning, nil
			}
			return lvm.VMHalted, nil
		}
	}
	return lvm.VMUnknown, lvm.ErrVMStateFailed
}
157107
func getStateFromEnv(b backend.Backend, env string) (*statefile.File, error) {
	// Get the state
	stateStore, err := b.StateMgr(env)
	if err != nil {
		return nil, fmt.Errorf("Failed to load state manager: %s", err)
	}

	if err := stateStore.RefreshState(); err != nil {
		return nil, fmt.Errorf("Failed to load state: %s", err)
	}

	sf := statemgr.Export(stateStore)

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

	return value, nil
}