// MakeExecution makes a new Execution in the SCHEDULING state, with a new
// random Token.
764792
func MakeExecution(c context.Context, e *dm.Execution_ID, cfgName, cfgVers string) *Execution {
	now := clock.Now(c).UTC()
	ret := &Execution{
		ID:      invertedHexUint32(e.Id),
		Attempt: AttemptKeyFromID(c, e.AttemptID()),

		Created:  now,
		Modified: now,

		DistributorConfigName:    cfgName,
		DistributorConfigVersion: cfgVers,

		Token: MakeRandomToken(c, dm.MinimumActivationTokenLength),
	}
	return ret
}
516254
func (w *WaitGen) Make() WaitInterface {
	if w.current != nil {
		return w.current
	}
	wt := w.gen()
	wt.Then().WhenOnly(func(_ interface{}) {
		w.current = nil
	})
	return wt
}
1349750
func (b *executorBuilder) buildExplain(v *plannercore.Explain) Executor {
	explainExec := &ExplainExec{
		baseExecutor: newBaseExecutor(b.ctx, v.Schema(), v.ExplainID()),
		explain:      v,
	}
	if v.Analyze {
		b.ctx.GetSessionVars().StmtCtx.RuntimeStatsColl = execdetails.NewRuntimeStatsColl()
		explainExec.analyzeExec = b.build(v.ExecPlan)
	}
	return explainExec
}
306514
func (a *ResolveNodeArgs) SetExecutionContextID(executionContextID runtime.ExecutionContextID) *ResolveNodeArgs {
	a.ExecutionContextID = &executionContextID
	return a
}
156336
func (s *DescribeWorkflowExecutionInput) SetExecution(v *WorkflowExecution) *DescribeWorkflowExecutionInput {
	s.Execution = v
	return s
}
874444
func (s *Prover) RequestExpectation(ctx context.Context, header *token.Header, request *token.ExpectationRequest) (*token.CommandResponse_TokenTransaction, error) {
	if request.GetExpectation() == nil {
		return nil, errors.New("ExpectationRequest has nil Expectation")
	}
	plainExpectation := request.GetExpectation().GetPlainExpectation()
	if plainExpectation == nil {
		return nil, errors.New("ExpectationRequest has nil PlainExpectation")
	}

	// get either issuer or transactor based on payload type in the request
	var tokenTransaction *token.TokenTransaction
	switch t := plainExpectation.GetPayload().(type) {
	case *token.PlainExpectation_ImportExpectation:
		issuer, err := s.TMSManager.GetIssuer(header.ChannelId, request.Credential, header.Creator)
		if err != nil {
			return nil, err
		}
		tokenTransaction, err = issuer.RequestExpectation(request)
		if err != nil {
			return nil, err
		}
	case *token.PlainExpectation_TransferExpectation:
		transactor, err := s.TMSManager.GetTransactor(header.ChannelId, request.Credential, header.Creator)
		if err != nil {
			return nil, err
		}
		defer transactor.Done()

		tokenTransaction, err = transactor.RequestExpectation(request)
		if err != nil {
			return nil, err
		}
	default:
		return nil, errors.Errorf("expectation payload type not recognized: %T", t)
	}

	return &token.CommandResponse_TokenTransaction{TokenTransaction: tokenTransaction}, nil
}
733909
func makeSwap(size int64) executionFunc {
	// switch n + 1 otherwise n would be swapped with n
	size++
	return func(pc *uint64, interpreter *EVMInterpreter, contract *Contract, memory *Memory, stack *Stack) ([]byte, error) {
		stack.swap(int(size))
		return nil, nil
	}
}
634275
func (s *GetCommandInvocationOutput) SetExecutionStartDateTime(v string) *GetCommandInvocationOutput {
	s.ExecutionStartDateTime = &v
	return s
}
1037877
func makeUnexpectedError(t *token, while string) error {
	return MakeStaticError(
		fmt.Sprintf("Unexpected: %v while %v", t, while), t.loc)
}
831051
func (s *InstanceAssociationStatusInfo) SetExecutionDate(v time.Time) *InstanceAssociationStatusInfo {
	s.ExecutionDate = &v
	return s
}
995897
func (s *JobUpdate) SetExecutionProperty(v *ExecutionProperty) *JobUpdate {
	s.ExecutionProperty = v
	return s
}
576083
func (c Call) MakeExpr(output *Term) *Expr {
	terms := []*Term(c)
	return NewExpr(append(terms, output))
}
107737
func (n *NamedStmt) MustExec(arg interface{}) sql.Result {
	res, err := n.Exec(arg)
	if err != nil {
		panic(err)
	}
	return res
}
408096
func MustExec(e Execer, query string, args ...interface{}) sql.Result {
	res, err := e.Exec(query, args...)
	if err != nil {
		panic(err)
	}
	return res
}
406792
func (rp *ReplicatorPlan) buildExecutionPlan(fieldEvent *binlogdatapb.FieldEvent) (*TablePlan, error) {
	prelim := rp.TablePlans[fieldEvent.TableName]
	if prelim == nil {
		// Unreachable code.
		return nil, fmt.Errorf("plan not found for %s", fieldEvent.TableName)
	}
	if prelim.Insert != nil {
		tplanv := *prelim
		tplanv.Fields = fieldEvent.Fields
		return &tplanv, nil
	}
	// select * construct was used. We need to use the field names.
	tplan, err := rp.buildFromFields(prelim.TargetName, fieldEvent.Fields)
	if err != nil {
		return nil, err
	}
	tplan.Fields = fieldEvent.Fields
	return tplan, nil
}
1251656
func (s *DescribeModelOutput) SetExecutionRoleArn(v string) *DescribeModelOutput {
	s.ExecutionRoleArn = &v
	return s
}
718072
func AuthenticateExecution(c context.Context, auth *dm.Execution_Auth) (a *Attempt, e *Execution, err error) {
	a, e, err = verifyExecutionAndCheckExTok(c, auth)
	if err != nil {
		logging.Fields{ek: err, "eid": auth.Id}.Errorf(c, "failed to verify execution")
		err = makeError(err, "requires execution Auth")
	}
	return a, e, err
}