Documentation ¶
Index ¶
- type Configure
- type DryRunFunc
- type ExecutionContext
- func (c *ExecutionContext) Attribute(key model.AttributeKey, v any) error
- func (c *ExecutionContext) Complete()
- func (c *ExecutionContext) Context() context.Context
- func (c *ExecutionContext) Error(err error)
- func (c *ExecutionContext) Failed() error
- func (c *ExecutionContext) Operation() *Operation
- func (c *ExecutionContext) Retry() error
- func (c *ExecutionContext) Running() error
- func (c *ExecutionContext) SaveChanges() error
- func (c *ExecutionContext) Success()
- func (c *ExecutionContext) Value(v any) error
- type Executor
- type Operation
- func (o *Operation) Attribute(key model.AttributeKey, v any) error
- func (o *Operation) Complete() error
- func (o *Operation) Context() context.Context
- func (o *Operation) Deployment() *model.Deployment
- func (o *Operation) Do(fn OperationFunc)
- func (o *Operation) Execute() error
- func (o *Operation) Failed() error
- func (o *Operation) Retry() error
- func (o *Operation) Running() error
- func (o *Operation) SaveChanges() error
- func (o *Operation) Schedule() error
- func (o *Operation) Success() error
- func (o *Operation) Value(v any) error
- type OperationFunc
- type OperationFuncProvider
- type OperationService
- type Repository
- type RetriableError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DryRunFunc ¶
type DryRunFunc func(context.Context, *deployment.AzureDeployment) (*sdk.DryRunResult, error)
this is so the dry run can be tested, detaching actual dry run implementation
type ExecutionContext ¶
type ExecutionContext struct {
// contains filtered or unexported fields
}
Context object for interacting with an operation execution
remarks: flyweight of an Operation
func (*ExecutionContext) Attribute ¶
func (c *ExecutionContext) Attribute(key model.AttributeKey, v any) error
func (*ExecutionContext) Complete ¶
func (c *ExecutionContext) Complete()
func (*ExecutionContext) Context ¶
func (c *ExecutionContext) Context() context.Context
func (*ExecutionContext) Error ¶
func (c *ExecutionContext) Error(err error)
func (*ExecutionContext) Failed ¶
func (c *ExecutionContext) Failed() error
func (*ExecutionContext) Operation ¶
func (c *ExecutionContext) Operation() *Operation
func (*ExecutionContext) Retry ¶
func (c *ExecutionContext) Retry() error
func (*ExecutionContext) Running ¶
func (c *ExecutionContext) Running() error
func (*ExecutionContext) SaveChanges ¶
func (c *ExecutionContext) SaveChanges() error
func (*ExecutionContext) Success ¶
func (c *ExecutionContext) Success()
func (*ExecutionContext) Value ¶
func (c *ExecutionContext) Value(v any) error
type Executor ¶
type Executor interface {
Execute(context *ExecutionContext) error
}
Executor is the interface for the actual execution of a logically invoked operation from the API Requestor --> invoke this operation --> enqueue --> executor --> execute the operation
func NewExecutor ¶
func NewExecutor(operation OperationFunc) Executor
default operations executor that executions the operation(s) in sequence with logging and default retry logic
remarks: if any of the operations return an error, the executor considers this a failure and will not execute
type Operation ¶
type Operation struct { model.InvokedOperation // contains filtered or unexported fields }
remarks: Invoked Operation decorator+visitor
func (*Operation) Deployment ¶
func (o *Operation) Deployment() *model.Deployment
provides access to latest instance of associated deployment
func (*Operation) Do ¶
func (o *Operation) Do(fn OperationFunc)
sets the operation's execution function
func (*Operation) Retry ¶
Attempts to trigger a retry of the operation, if the operation has a retriable state
func (*Operation) SaveChanges ¶
type OperationFunc ¶
type OperationFunc func(context *ExecutionContext) error
a executable operation with an execution context
func WithLogging ¶
func WithLogging(operation OperationFunc) OperationFunc
type OperationFuncProvider ¶
type OperationFuncProvider interface {
Get(operationType sdk.OperationType) (OperationFunc, error)
}
type OperationService ¶
type OperationService struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewService(db *gorm.DB, sender messaging.MessageSender, notify hook.NotifyFunc) (*OperationService, error)
constructor factory of operation service
func (*OperationService) Context ¶
func (service *OperationService) Context() context.Context
type Repository ¶
type Repository interface { New(operationType sdk.OperationType, configure Configure) (*Operation, error) First(id uuid.UUID) (*Operation, error) Provider(provider OperationFuncProvider) error WithContext(ctx context.Context) }
Operation factory
func NewRepository ¶
func NewRepository(service *OperationService, provider OperationFuncProvider) (Repository, error)
NewRepository creates a new operation factory appConfig: application configuration provider: operation function provider, optional if the operation is not going to be executed and you want to interact with the operation
type RetriableError ¶
RetriableError is a custom error that contains a positive duration for the next retry
func (*RetriableError) Error ¶
func (e *RetriableError) Error() string
Error returns error message and a Retry-After duration