// getStates returns multiple task states
491562
func (b *Backend) getStates(taskUUIDs ...string) ([]*tasks.TaskState, error) {
	states := make([]*tasks.TaskState, 0, len(taskUUIDs))
	cur, err := b.tasksCollection.Find(context.Background(), bson.M{"_id": bson.M{"$in": taskUUIDs}})
	if err != nil {
		return nil, err
	}
	defer cur.Close(context.Background())

	for cur.Next(context.Background()) {
		state := &tasks.TaskState{}
		if err := cur.Decode(state); err != nil {
			return nil, err
		}
		states = append(states, state)
	}
	if cur.Err() != nil {
		return nil, err
	}
	return states, nil
}
970129
func (self *stateObject) GetState(db Database, key common.Hash) common.Hash {
	// If we have a dirty value for this state entry, return it
	value, dirty := self.dirtyStorage[key]
	if dirty {
		return value
	}
	// Otherwise return the entry's original value
	return self.GetCommittedState(db, key)
}
1135176
func (vm *VM) GetState() (string, error) {
	id := fmt.Sprintf("%v", vm.Droplet.ID)
	if id == "" {
		return "", ErrNoInstanceID
	}

	client := &http.Client{}
	req, err := BuildRequest(vm.APIToken, "GET", apiBaseURL+apiDropletURL+"/"+id, nil)
	if err != nil {
		return "", err
	}
	rsp, err := client.Do(req)
	if err != nil {
		return "", err
	}
	defer rsp.Body.Close()
	b, err := ioutil.ReadAll(rsp.Body)
	if err != nil {
		return "", err
	}
	if rsp.StatusCode == StatusNotFound {
		return "not_found", nil
	}
	if rsp.Status[0] != StatusOk {
		return "", fmt.Errorf("Error: %s: %s", rsp.Status, string(b))
	}

	// Fill out vm.Droplet with data on droplet
	r := &DropletResponse{}
	err = json.Unmarshal(b, r)
	if err != nil {
		return "", err
	}
	vm.Droplet = r.Droplet
	return vm.Droplet.Status, nil
}
379096
func (c ClientCookies) GetState(r *http.Request, id string) string {
	stateCookie, err := r.Cookie(stateCookiePrefix + id)
	if err != nil {
		return ""
	}
	return stateCookie.Value
}
1194616
func GetState(fd int) (*State, error) {
	termios, err := getTermios(fd)
	if err != nil {
		return nil, err
	}

	return &State{termios: *termios}, nil
}
725551
func GetState(s string) (State, error) {
	lower := strings.ToLower(s)
	switch {
	case lower == "":
		return State_STATE_UNSPECIFIED, nil
	case strings.HasPrefix("free", lower):
		return State_FREE, nil
	case strings.HasPrefix("prerelease", lower):
		return State_PRERELEASE, nil
	case strings.HasPrefix("serving", lower):
		return State_SERVING, nil
	case strings.HasPrefix("test", lower):
		return State_TEST, nil
	case strings.HasPrefix("repair", lower):
		return State_REPAIR, nil
	case strings.HasPrefix("decommissioned", lower):
		return State_DECOMMISSIONED, nil
	default:
		return -1, errors.Reason("string %q did not match any known state", s).Err()
	}
}
1243169
func (p *Project) GetState() string {
	if p == nil || p.State == nil {
		return ""
	}
	return *p.State
}
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
}
881487
func (cs *ConsensusState) GetState() sm.State {
	cs.mtx.RLock()
	defer cs.mtx.RUnlock()
	return cs.state.Copy()
}
1153327
func (b *Backend) getStates(taskUUIDs ...string) ([]*tasks.TaskState, error) {
	taskStates := make([]*tasks.TaskState, len(taskUUIDs))

	conn := b.open()
	defer conn.Close()

	// conn.Do requires []interface{}... can't pass []string unfortunately
	taskUUIDInterfaces := make([]interface{}, len(taskUUIDs))
	for i, taskUUID := range taskUUIDs {
		taskUUIDInterfaces[i] = interface{}(taskUUID)
	}

	reply, err := redis.Values(conn.Do("MGET", taskUUIDInterfaces...))
	if err != nil {
		return taskStates, err
	}

	for i, value := range reply {
		stateBytes, ok := value.([]byte)
		if !ok {
			return taskStates, fmt.Errorf("Expected byte array, instead got: %v", value)
		}

		taskState := new(tasks.TaskState)
		decoder := json.NewDecoder(bytes.NewReader(stateBytes))
		decoder.UseNumber()
		if err := decoder.Decode(taskState); err != nil {
			log.ERROR.Print(err)
			return taskStates, err
		}

		taskStates[i] = taskState
	}

	return taskStates, nil
}
336389
func (vdb *versionedDB) GetState(namespace string, key string) (*statedb.VersionedValue, error) {
	logger.Debugf("GetState(). ns=%s, key=%s", namespace, key)
	compositeKey := constructCompositeKey(namespace, key)
	dbVal, err := vdb.db.Get(compositeKey)
	if err != nil {
		return nil, err
	}
	if dbVal == nil {
		return nil, nil
	}
	return decodeValue(dbVal)
}
1142568
func (s *server) GetState() string {
	s.mutex.RLock()
	defer s.mutex.RUnlock()
	return fmt.Sprintf("Name: %s, State: %s, Term: %v, CommitedIndex: %v ", s.name, s.state, s.currentTerm, s.log.commitIndex)
}
153504
func (vm *VM) GetState() (state string, err error) {
	if err := SetupSession(vm); err != nil {
		return "", lvm.ErrVMInfoFailed
	}
	defer func() {
		vm.client.Logout(vm.ctx)
		vm.cancel()
	}()
	state, err = getState(vm)
	if err != nil {
		return "", err
	}

	if state == "running" {
		return lvm.VMRunning, nil
	} else if state == "standby" {
		return lvm.VMSuspended, nil
	} else if state == "shuttingDown" || state == "resetting" || state == "notRunning" {
		return lvm.VMHalted, nil
	}
	// VM state "unknown"
	return "", lvm.ErrVMInfoFailed
}
1253041
func (p *ReadOnlySchedulerClient) GetTasksStatus(ctx context.Context, query *TaskQuery) (r *Response, err error) {
  var _args56 ReadOnlySchedulerGetTasksStatusArgs
  _args56.Query = query
  var _result57 ReadOnlySchedulerGetTasksStatusResult
  if err = p.Client_().Call(ctx, "getTasksStatus", &_args56, &_result57); err != nil {
    return
  }
  return _result57.GetSuccess(), nil
}
1054089
func (r *ReleaseAsset) GetState() string {
	if r == nil || r.State == nil {
		return ""
	}
	return *r.State
}
854975
func (api *TasksAPI) GetAll(options *TaskGetOptions) (result *TaskList, err error) {
	uri := api.client.Endpoint + taskUrl
	if options != nil {
		uri += getQueryString(options)
	}
	res, err := api.client.restClient.GetList(api.client.Endpoint, uri, api.client.options.TokenOptions)
	if err != nil {
		return
	}

	result = &TaskList{}
	err = json.Unmarshal(res, result)

	return
}
1233532
func (c *Ctx) GetOperationState(sh SessionHandle) ([]byte, error) {
	var (
		state    C.CK_BYTE_PTR
		statelen C.CK_ULONG
	)
	e := C.GetOperationState(c.ctx, C.CK_SESSION_HANDLE(sh), &state, &statelen)
	defer C.free(unsafe.Pointer(state))
	if toError(e) != nil {
		return nil, toError(e)
	}
	b := C.GoBytes(unsafe.Pointer(state), C.int(statelen))
	return b, nil
}