// ToETLState converts the etl tag value (in string) to the corresponding ETLState
762043
func ToETLState(s string) (ETLState, error) {
	st := ETLState(s)
	switch st {
	case EtlOn:
		return EtlOn, nil
	case EtlOff:
		return EtlOff, nil
	default:
		return EtlOff, fmt.Errorf("%s: %s", errUnrecognizedETLState, s)
	}
}
908815
func ValidateState(state string) error {
	if !okayStates.Contains(state) {
		supported := okayStates.Values()
		sort.Strings(supported)
		states := strings.Join(supported, `", "`)
		msg := fmt.Sprintf(`status %q not supported; expected one of ["%s"]`, state, states)
		return errors.NewNotValid(nil, msg)
	}
	return nil
}
670678
func (s *BoltStateDB) PutTaskRunnerLocalState(allocID, taskName string, val *trstate.LocalState) error {
	return s.db.Update(func(tx *boltdd.Tx) error {
		return putTaskRunnerLocalStateImpl(tx, allocID, taskName, val)
	})
}
1299291
func (bc *BlockChain) StateAt(root common.Hash) (*state.StateDB, error) {
	return state.New(root, bc.stateCache)
}
1120224
func StateValueFromInstanceState(is *terraform.InstanceState, ty cty.Type) (cty.Value, error) {
	return is.AttrsAsObjectValue(ty)
}
504962
func parseETLTag(tag string) (string, ETLState, error) {
	fullETLTag := ""
	etlTag := ""
	matches := etlPattern0.FindStringSubmatch(tag)
	if len(matches) == 2 {
		fullETLTag = matches[0]
		etlTag = matches[1]
	}

	if len(matches) == 0 {
		return "", EtlOff, nil
	}

	// filter out "trailing comma"
	etlTag = strings.TrimRight(etlTag, " ,")

	var err error
	etlTag, err = NormalizeName(etlTag)
	if err != nil {
		return "", EtlOff, err
	}

	etlState, err := ToETLState(etlTag)
	if err != nil {
		return "", EtlOff, err
	}
	return fullETLTag, etlState, nil
}
862580
func stateSetDelim(l *lexer) stateFn {
	end := "=" + l.rightDelim
	i := strings.Index(l.input[l.pos:], end)
	if i < 0 {
		return l.errorf("unclosed tag")
	}
	delims := strings.Split(l.input[l.pos:l.pos+i], " ") // " | | "
	if len(delims) < 2 {
		l.errorf("set delimiters should be separated by a space")
	}
	delimFn := leftFn
	for _, delim := range delims {
		if delim != "" {
			if delimFn != nil {
				delimFn = delimFn(l, delim)
			}
		}
	}
	l.seek(i + len(end))
	l.ignore()
	l.emit(tokenSetDelim)
	return stateText
}
408648
func (c *upgradeContext) APIState() api.Connection {
	if c.api == nil {
		panic("API not available from this context")
	}
	return c.api
}
656626
func (c *Client) GetAllocState(allocID string) (*arstate.State, error) {
	ar, err := c.getAllocRunner(allocID)
	if err != nil {
		return nil, err
	}

	return ar.AllocState(), nil
}
1120323
func (b *BlockChain) ThresholdState(deploymentID uint32) (ThresholdState, error) {
	b.chainLock.Lock()
	state, err := b.deploymentState(b.bestChain.Tip(), deploymentID)
	b.chainLock.Unlock()

	return state, err
}
682402
func (bot *ExchangeBot) State() *ExchangeBotState {
	bot.mtx.RLock()
	defer bot.mtx.RUnlock()
	return bot.stateCopy
}
935964
func (w *StatusWorker) StatusAsText() string {
	w.mu.Lock()
	defer w.mu.Unlock()

	return "State: " + w.state.String() + "\n"
}
306815
func (f *FastTeamChainLoader) mutateState(m libkb.MetaContext, arg fastLoadArg, state *keybase1.FastTeamData, groceries *groceries) (err error) {

	err = f.putName(m, arg, state, groceries.newLinks)
	if err != nil {
		return err
	}
	err = f.putLinks(m, arg, state, groceries.newLinks)
	if err != nil {
		return err
	}
	err = f.putRKMs(m, arg, state, groceries.rkms)
	if err != nil {
		return err
	}
	err = f.putSeeds(m, arg, state, groceries.latestKeyGen, groceries.seeds)
	if err != nil {
		return err
	}
	err = f.putMetadata(m, arg, state)
	if err != nil {
		return err
	}
	return nil
}
737770
func (w *StatusWorker) StatusAsHTML() template.HTML {
	w.mu.Lock()
	defer w.mu.Unlock()

	return template.HTML("<b>State:</b> " + w.state.String() + "</br>\n")
}
293804
func (db *DB) STTL(key []byte) (int64, error) {
	if err := checkKeySize(key); err != nil {
		return -1, err
	}

	return db.ttl(SetType, key)
}
577582
func (vrsConnection *VRSConnection) SetEntityState(uuid string, state entity.State, subState entity.SubState) error {

	row := make(map[string]interface{})
	row[ovsdb.NuageVMTableColumnState] = int(state)
	row[ovsdb.NuageVMTableColumnReason] = int(subState)

	condition := []string{ovsdb.NuageVMTableColumnVMUUID, "==", uuid}

	if err := vrsConnection.vmTable.UpdateRow(vrsConnection.ovsdbClient, row, condition); err != nil {
		return fmt.Errorf("Unable to update the state %s %v %v %v", uuid, state, subState, err)
	}

	return nil
}
3557
func newEvalState() *evalState {
	return &evalState{
		status: structs.EvalStatusPending,
		allocs: make(map[string]*allocState),
	}
}