Documentation ¶
Index ¶
- type AzureDeploymentNameFinder
- type Configure
- type DeployStageOperationFactory
- type DeployStageOperationMap
- type DryRunFunc
- type ExecuteOperationCommand
- 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) IsExecutable() ([]string, bool)
- func (c *ExecutionContext) Operation() *Operation
- func (c *ExecutionContext) Pending() error
- 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 FinderResponse
- 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) Execute() error
- func (o *Operation) Failed() error
- func (o *Operation) Pending() 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) Task(task OperationTask)
- func (o *Operation) Value(v any) error
- type OperationError
- type OperationFunc
- type OperationFuncProvider
- type OperationManager
- type OperationTask
- type OperationTaskOptions
- type OperationWatcher
- type OperationWatcherOptions
- type Repository
- type RepositoryFactory
- type RetriableError
- type Scheduler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AzureDeploymentNameFinder ¶ added in v1.3.4
type AzureDeploymentNameFinder struct {
// contains filtered or unexported fields
}
func NewAzureDeploymentNameFinder ¶ added in v1.3.4
func NewAzureDeploymentNameFinder(operation *Operation) (*AzureDeploymentNameFinder, error)
func (*AzureDeploymentNameFinder) FindUntilDone ¶ added in v1.3.4
func (finder *AzureDeploymentNameFinder) FindUntilDone(ctx context.Context) (string, error)
type DeployStageOperationFactory ¶ added in v1.3.4
type DeployStageOperationFactory struct {
// contains filtered or unexported fields
}
func NewDeployStageOperationFactory ¶ added in v1.3.4
func NewDeployStageOperationFactory(repository Repository) *DeployStageOperationFactory
func (*DeployStageOperationFactory) Create ¶ added in v1.3.4
func (f *DeployStageOperationFactory) Create(parent *Operation) (DeployStageOperationMap, error)
create a new deploy stage operation for each stage associated to the parent
type DeployStageOperationMap ¶ added in v1.3.4
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 ExecuteOperationCommand ¶ added in v1.3.5
this represents the message (command) that is sent to the operator to be executed
remarks: this will be sent over the messaging infrastructure
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) IsExecutable ¶ added in v1.3.5
func (c *ExecutionContext) IsExecutable() ([]string, bool)
func (*ExecutionContext) Operation ¶
func (c *ExecutionContext) Operation() *Operation
func (*ExecutionContext) Pending ¶ added in v1.3.5
func (c *ExecutionContext) Pending() error
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 FinderResponse ¶ added in v1.3.4
type FinderResponse struct {
Name string
}
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) Retry ¶
Attempts to trigger a retry of the operation, if the operation has a retriable state
func (*Operation) SaveChanges ¶
func (*Operation) Task ¶ added in v1.3.5
func (o *Operation) Task(task OperationTask)
sets the operation's task function
type OperationError ¶ added in v1.3.4
type OperationError struct {
// contains filtered or unexported fields
}
func NewError ¶ added in v1.3.4
func NewError(operation *Operation) *OperationError
func (*OperationError) Error ¶ added in v1.3.4
func (e *OperationError) Error() string
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) (OperationTask, error)
}
type OperationManager ¶ added in v1.3.4
type OperationManager struct {
// contains filtered or unexported fields
}
func CloneManager ¶ added in v1.3.4
func CloneManager(manager *OperationManager) *OperationManager
func NewManager ¶ added in v1.3.4
func NewManager(db *gorm.DB, scheduler Scheduler, notify hook.NotifyFunc) (*OperationManager, error)
constructor factory of operation service
func (*OperationManager) Context ¶ added in v1.3.4
func (manager *OperationManager) Context() context.Context
type OperationTask ¶ added in v1.3.5
type OperationTask interface { Run(context ExecutionContext) error Continue(context ExecutionContext) error }
func NewOperationTask ¶ added in v1.3.5
func NewOperationTask(options OperationTaskOptions) OperationTask
type OperationTaskOptions ¶ added in v1.3.5
type OperationTaskOptions struct { Run OperationFunc //default run function Continue OperationFunc //if the run is intereupted, this function will be invoked }
Represents the task that the operation will perform
type OperationWatcher ¶ added in v1.3.4
type OperationWatcher interface { // watch the operation with the given operation id for completion // id: the operation id // Watch(id uuid.UUID, options OperationWatcherOptions) (threading.CancellationToken, error) }
func NewWatcher ¶ added in v1.3.4
func NewWatcher(repository Repository) OperationWatcher
type OperationWatcherOptions ¶ added in v1.3.4
type OperationWatcherOptions struct { Condition func(operation model.InvokedOperation) bool // the condition to watch for Frequency time.Duration }
type Repository ¶
type Repository interface { New(operationType sdk.OperationType, configure Configure) (*Operation, error) First(id uuid.UUID) (*Operation, error) Any(id uuid.UUID) bool Provider(provider OperationFuncProvider) error WithContext(ctx context.Context) }
Operation factory
func NewRepository ¶
func NewRepository(manager *OperationManager, provider OperationFuncProvider) (Repository, error)
NewRepository creates a new operation repository 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 RepositoryFactory ¶ added in v1.3.4
type RepositoryFactory func() (Repository, error)
func NewRepositoryFactory ¶ added in v1.3.4
func NewRepositoryFactory(appConfig *config.AppConfig) RepositoryFactory
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
type Scheduler ¶ added in v1.3.5
func NewScheduler ¶ added in v1.3.5
func NewScheduler(sender messaging.MessageSender) (Scheduler, error)