Documentation ¶
Index ¶
- Constants
- func FindCascadeOperationForResource(ctx context.Context, storage storage.Repository, resourceID string) (*types.Operation, error)
- func GetAllLevelsCascadeOperations(ctx context.Context, object types.Object, operation *types.Operation, ...) ([]*types.Operation, error)
- func GetObjectChildren(ctx context.Context, object types.Object, storage storage.Repository) (cascade.CascadeChildren, error)
- func GetSubOperations(ctx context.Context, operation *types.Operation, repository storage.Repository) (*cascade.CascadedOperations, error)
- func PrepareAggregatedErrorsArray(failedSubOperations []*types.Operation, resourceID string, ...) ([]byte, error)
- type Maintainer
- type PoolSettings
- type Scheduler
- func (s *Scheduler) ScheduleAsyncStorageAction(ctx context.Context, operation *types.Operation, action storageAction) error
- func (s *Scheduler) ScheduleStorageAction(ctx context.Context, operation *types.Operation, action storageAction, ...) (types.Object, bool, error)
- func (s *Scheduler) ScheduleSyncStorageAction(ctx context.Context, operation *types.Operation, action storageAction) (types.Object, error)
- type Settings
Constants ¶
const (
ZeroTime = "0001-01-01 00:00:00+00"
)
Variables ¶
This section is empty.
Functions ¶
func FindCascadeOperationForResource ¶ added in v0.16.11
func GetAllLevelsCascadeOperations ¶ added in v0.14.0
func GetObjectChildren ¶ added in v0.14.0
func GetObjectChildren(ctx context.Context, object types.Object, storage storage.Repository) (cascade.CascadeChildren, error)
func GetSubOperations ¶ added in v0.14.0
func GetSubOperations(ctx context.Context, operation *types.Operation, repository storage.Repository) (*cascade.CascadedOperations, error)
func PrepareAggregatedErrorsArray ¶ added in v0.14.0
Types ¶
type Maintainer ¶
type Maintainer struct {
// contains filtered or unexported fields
}
Maintainer ensures that operations old enough are deleted and that no orphan operations are left in the DB due to crashes/restarts of SM
func NewMaintainer ¶
func NewMaintainer(smCtx context.Context, repository storage.TransactionalRepository, lockerCreatorFunc storage.LockerCreatorFunc, options *Settings, wg *sync.WaitGroup) *Maintainer
NewMaintainer constructs a Maintainer
func (*Maintainer) CleanupFinishedCascadeOperations ¶ added in v0.14.0
func (om *Maintainer) CleanupFinishedCascadeOperations()
cleanupFinishedCascadeOperations cleans up all successful/failed internal cascade operations which are older than some specified time
func (*Maintainer) CleanupResourcelessOperations ¶ added in v0.15.1
func (om *Maintainer) CleanupResourcelessOperations()
func (*Maintainer) PollUpdateCascadeOperations ¶ added in v0.19.1
func (om *Maintainer) PollUpdateCascadeOperations()
func (*Maintainer) Run ¶
func (om *Maintainer) Run()
Run starts the two recurring jobs responsible for cleaning up operations which are too old and deleting orphan operations
type PoolSettings ¶
type PoolSettings struct { Resource string `mapstructure:"resource" description:"name of the resource for which a worker pool is created"` Size int `mapstructure:"size" description:"size of the worker pool"` }
PoolSettings defines the settings for a worker pool
func (*PoolSettings) Validate ¶
func (ps *PoolSettings) Validate() error
Validate validates the Pool settings
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler is responsible for storing Operation entities in the DB and also for spawning goroutines to execute the respective DB transaction asynchronously
func NewScheduler ¶
func NewScheduler(smCtx context.Context, repository storage.TransactionalRepository, settings *Settings, poolSize int, wg *sync.WaitGroup) *Scheduler
NewScheduler constructs a Scheduler
func (*Scheduler) ScheduleAsyncStorageAction ¶ added in v0.10.0
func (s *Scheduler) ScheduleAsyncStorageAction(ctx context.Context, operation *types.Operation, action storageAction) error
ScheduleAsyncStorageAction stores the job's Operation entity in DB asynchronously executes the CREATE/UPDATE/DELETE DB transaction in a goroutine
func (*Scheduler) ScheduleStorageAction ¶ added in v0.15.2
func (s *Scheduler) ScheduleStorageAction(ctx context.Context, operation *types.Operation, action storageAction, isAsyncSupported bool) (types.Object, bool, error)
Identifies the preferred execution mode and execute the storage action
func (*Scheduler) ScheduleSyncStorageAction ¶ added in v0.10.0
func (s *Scheduler) ScheduleSyncStorageAction(ctx context.Context, operation *types.Operation, action storageAction) (types.Object, error)
ScheduleSyncStorageAction stores the job's Operation entity in DB and synchronously executes the CREATE/UPDATE/DELETE DB transaction
type Settings ¶
type Settings struct { ActionTimeout time.Duration `mapstructure:"action_timeout" description:"timeout for async operations"` ReconciliationOperationTimeout time.Duration `` /* 132-byte string literal not displayed */ CascadeOrphanMitigationTimeout time.Duration `` /* 130-byte string literal not displayed */ PollCascadeInterval time.Duration `mapstructure:"poll_cascade_interval" description:"poll interval for cascade operations"` CleanupInterval time.Duration `mapstructure:"cleanup_interval" description:"cleanup interval of old operations"` MaintainerRetryInterval time.Duration `mapstructure:"maintainer_retry_interval" description:"maintenance retry interval"` Lifespan time.Duration `` /* 133-byte string literal not displayed */ ReschedulingInterval time.Duration `mapstructure:"rescheduling_interval" description:"the interval between auto rescheduling of operation actions"` PollingInterval time.Duration `mapstructure:"polling_interval" description:"the interval between polls for async requests"` DefaultPoolSize int `mapstructure:"default_pool_size" description:"default worker pool size"` DefaultCascadePollingPoolSize int `mapstructure:"default_cascade_polling_pool_size" description:"default worker pool size"` Pools []PoolSettings `mapstructure:"pools" description:"defines the different available worker pools"` SMSupportedPlatformType []string `` /* 127-byte string literal not displayed */ }
Settings type to be loaded from the environment
func DefaultSettings ¶
func DefaultSettings() *Settings
DefaultSettings returns default values for API settings