Documentation
¶
Index ¶
- Variables
- func Provide(i *do.Injector)
- type LogEntry
- type Options
- type Scope
- type Service
- func (s *Service) AddLogEntry(ctx context.Context, scope Scope, entityID string, taskID uuid.UUID, ...) error
- func (s *Service) CreateTask(ctx context.Context, opts Options) (*Task, error)
- func (s *Service) DeleteAllTaskLogs(ctx context.Context, scope Scope, entityID string) error
- func (s *Service) DeleteAllTasks(ctx context.Context, scope Scope, entityID string) error
- func (s *Service) DeleteTask(ctx context.Context, scope Scope, entityID string, taskID uuid.UUID) error
- func (s *Service) DeleteTaskLogs(ctx context.Context, scope Scope, entityID string, taskID uuid.UUID) error
- func (s *Service) GetTask(ctx context.Context, scope Scope, entityID string, taskID uuid.UUID) (*Task, error)
- func (s *Service) GetTaskLog(ctx context.Context, scope Scope, entityID string, taskID uuid.UUID, ...) (*TaskLog, error)
- func (s *Service) GetTasks(ctx context.Context, scope Scope, entityID string, options TaskListOptions) ([]*Task, error)
- func (s *Service) UpdateTask(ctx context.Context, task *Task) error
- type SortOrder
- type Status
- type Store
- type StoredTask
- type StoredTaskLogEntry
- type Task
- type TaskListOptions
- type TaskLog
- type TaskLogEntryStore
- func (s *TaskLogEntryStore) DatabasePrefix(databaseID string) string
- func (s *TaskLogEntryStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
- func (s *TaskLogEntryStore) DeleteByEntity(scope Scope, entityID string) storage.DeleteOp
- func (s *TaskLogEntryStore) DeleteByTask(scope Scope, entityID string, taskID uuid.UUID) storage.DeleteOp
- func (s *TaskLogEntryStore) DeleteByTaskID(databaseID string, taskID uuid.UUID) storage.DeleteOp
- func (s *TaskLogEntryStore) EntityPrefix(scope Scope, entityID string) string
- func (s *TaskLogEntryStore) GetAllByTask(scope Scope, entityID string, taskID uuid.UUID, options TaskLogOptions) storage.GetMultipleOp[*StoredTaskLogEntry]
- func (s *TaskLogEntryStore) GetAllByTaskID(databaseID string, taskID uuid.UUID, options TaskLogOptions) storage.GetMultipleOp[*StoredTaskLogEntry]
- func (s *TaskLogEntryStore) Key(scope Scope, entityID string, taskID, entryID uuid.UUID) string
- func (s *TaskLogEntryStore) KeyDeprecated(databaseID string, taskID, entryID uuid.UUID) string
- func (s *TaskLogEntryStore) Prefix() string
- func (s *TaskLogEntryStore) Put(item *StoredTaskLogEntry) storage.PutOp[*StoredTaskLogEntry]
- func (s *TaskLogEntryStore) TaskPrefix(scope Scope, entityID string, taskID uuid.UUID) string
- func (s *TaskLogEntryStore) TaskPrefixDeprecated(databaseID string, taskID uuid.UUID) string
- type TaskLogOptions
- type TaskLogWriter
- type TaskStore
- func (s *TaskStore) Create(item *StoredTask) storage.PutOp[*StoredTask]
- func (s *TaskStore) Delete(scope Scope, entityID string, taskID uuid.UUID) storage.DeleteOp
- func (s *TaskStore) DeleteByEntity(scope Scope, entityID string) storage.DeleteOp
- func (s *TaskStore) EntityPrefix(scope Scope, entityID string) string
- func (s *TaskStore) GetAllByEntity(scope Scope, entityID string, options TaskListOptions) storage.GetMultipleOp[*StoredTask]
- func (s *TaskStore) GetByKey(scope Scope, entityID string, taskID uuid.UUID) storage.GetOp[*StoredTask]
- func (s *TaskStore) Key(scope Scope, entityID string, taskID uuid.UUID) string
- func (s *TaskStore) Prefix() string
- func (s *TaskStore) Update(item *StoredTask) storage.PutOp[*StoredTask]
- type Type
- type UpdateOptions
Constants ¶
This section is empty.
Variables ¶
var ErrTaskNotFound = errors.New("task not found")
Functions ¶
Types ¶
type Options ¶
type Options struct {
Scope Scope `json:"scope"`
ParentID uuid.UUID `json:"parent_id"`
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
InstanceID string `json:"instance_id"`
HostID string `json:"host_id"`
Type Type `json:"type"`
WorkflowInstanceID string `json:"workflow_id"`
WorkflowExecutionID string `json:"workflow_execution_id"`
}
type Service ¶
type Service struct {
Store *Store
}
func NewService ¶
func (*Service) AddLogEntry ¶
func (*Service) CreateTask ¶
func (*Service) DeleteAllTaskLogs ¶
func (*Service) DeleteAllTasks ¶
func (*Service) DeleteTask ¶
func (*Service) DeleteTaskLogs ¶
func (*Service) GetTaskLog ¶
type Store ¶
type Store struct {
Task *TaskStore
TaskLogMessage *TaskLogEntryStore
// contains filtered or unexported fields
}
type StoredTask ¶
type StoredTask struct {
storage.StoredValue
Task *Task `json:"task"`
}
type StoredTaskLogEntry ¶
type StoredTaskLogEntry struct {
storage.StoredValue
Scope Scope `json:"scope"`
EntityID string `json:"entity_id"`
DatabaseID string `json:"database_id"`
TaskID uuid.UUID `json:"task_id"`
EntryID uuid.UUID `json:"entry_id"`
Timestamp time.Time `json:"timestamp"`
Message string `json:"message"`
Fields map[string]any `json:"fields"`
}
type Task ¶
type Task struct {
Scope Scope `json:"scope"`
EntityID string `json:"entity_id"`
ParentID uuid.UUID `json:"parent_id"`
DatabaseID string `json:"database_id"`
NodeName string `json:"node_name"`
InstanceID string `json:"instance_id"`
HostID string `json:"host_id"`
TaskID uuid.UUID `json:"task_id"`
CreatedAt time.Time `json:"created_at"`
CompletedAt time.Time `json:"completed_at"`
Type Type `json:"type"`
WorkflowInstanceID string `json:"workflow_id"`
WorkflowExecutionID string `json:"workflow_execution_id"`
Status Status `json:"status"`
Error string `json:"error"`
}
func (*Task) IsComplete ¶
func (*Task) SetCompleted ¶
func (t *Task) SetCompleted()
func (*Task) Update ¶
func (t *Task) Update(options UpdateOptions)
type TaskListOptions ¶
type TaskLogEntryStore ¶
type TaskLogEntryStore struct {
// contains filtered or unexported fields
}
func NewTaskLogEntryStore ¶
func NewTaskLogEntryStore(client *clientv3.Client, root string) *TaskLogEntryStore
func (*TaskLogEntryStore) DatabasePrefix ¶
func (s *TaskLogEntryStore) DatabasePrefix(databaseID string) string
DatabasePrefix returns the prefix for all task log entries for a given database. Deprecated: Use EntityPrefix(ScopeDatabase, databaseID) instead.
func (*TaskLogEntryStore) DeleteByDatabaseID ¶
func (s *TaskLogEntryStore) DeleteByDatabaseID(databaseID string) storage.DeleteOp
DeleteByDatabaseID deletes all log entries for a database. Deprecated: Use DeleteByEntity(ScopeDatabase, databaseID) instead.
func (*TaskLogEntryStore) DeleteByEntity ¶ added in v0.7.0
func (s *TaskLogEntryStore) DeleteByEntity(scope Scope, entityID string) storage.DeleteOp
func (*TaskLogEntryStore) DeleteByTask ¶ added in v0.7.0
func (*TaskLogEntryStore) DeleteByTaskID ¶
DeleteByTaskID deletes all log entries for a task. Deprecated: Use DeleteByTask(ScopeDatabase, databaseID, taskID) instead.
func (*TaskLogEntryStore) EntityPrefix ¶ added in v0.7.0
func (s *TaskLogEntryStore) EntityPrefix(scope Scope, entityID string) string
EntityPrefix returns the prefix for all task log entries for a given scope and entity.
func (*TaskLogEntryStore) GetAllByTask ¶ added in v0.7.0
func (s *TaskLogEntryStore) GetAllByTask(scope Scope, entityID string, taskID uuid.UUID, options TaskLogOptions) storage.GetMultipleOp[*StoredTaskLogEntry]
func (*TaskLogEntryStore) GetAllByTaskID ¶
func (s *TaskLogEntryStore) GetAllByTaskID(databaseID string, taskID uuid.UUID, options TaskLogOptions) storage.GetMultipleOp[*StoredTaskLogEntry]
GetAllByTaskID retrieves all log entries for a task. Deprecated: Use GetAllByTask(ScopeDatabase, databaseID, taskID, options) instead.
func (*TaskLogEntryStore) KeyDeprecated ¶ added in v0.7.0
func (s *TaskLogEntryStore) KeyDeprecated(databaseID string, taskID, entryID uuid.UUID) string
KeyDeprecated returns the storage key for a task log entry. Deprecated: Use Key(ScopeDatabase, databaseID, taskID, entryID) instead.
func (*TaskLogEntryStore) Prefix ¶
func (s *TaskLogEntryStore) Prefix() string
func (*TaskLogEntryStore) Put ¶
func (s *TaskLogEntryStore) Put(item *StoredTaskLogEntry) storage.PutOp[*StoredTaskLogEntry]
func (*TaskLogEntryStore) TaskPrefix ¶
TaskPrefix returns the prefix for all log entries for a specific task.
func (*TaskLogEntryStore) TaskPrefixDeprecated ¶ added in v0.7.0
func (s *TaskLogEntryStore) TaskPrefixDeprecated(databaseID string, taskID uuid.UUID) string
TaskPrefixDeprecated returns the prefix for all log entries for a specific task. Deprecated: Use TaskPrefix(ScopeDatabase, databaseID, taskID) instead.
type TaskLogOptions ¶
type TaskLogWriter ¶
type TaskLogWriter struct {
// contains filtered or unexported fields
}
func NewTaskLogWriter ¶
func (*TaskLogWriter) Close ¶
func (w *TaskLogWriter) Close() error
type TaskStore ¶
type TaskStore struct {
// contains filtered or unexported fields
}
func (*TaskStore) Create ¶
func (s *TaskStore) Create(item *StoredTask) storage.PutOp[*StoredTask]
func (*TaskStore) DeleteByEntity ¶ added in v0.7.0
func (*TaskStore) EntityPrefix ¶ added in v0.7.0
func (*TaskStore) GetAllByEntity ¶ added in v0.7.0
func (s *TaskStore) GetAllByEntity(scope Scope, entityID string, options TaskListOptions) storage.GetMultipleOp[*StoredTask]
func (*TaskStore) Update ¶
func (s *TaskStore) Update(item *StoredTask) storage.PutOp[*StoredTask]
type Type ¶
type Type string
const ( TypeCreate Type = "create" TypeUpdate Type = "update" TypeDelete Type = "delete" TypeNodeBackup Type = "node_backup" TypeRestore Type = "restore" TypeNodeRestore Type = "node_restore" TypeRestartInstance Type = "restart_instance" TypeStopInstance Type = "stop_instance" TypeStartInstance Type = "start_instance" TypeSwitchover Type = "switchover" TypeFailover Type = "failover" TypeRemoveHost Type = "remove_host" )
type UpdateOptions ¶
type UpdateOptions struct {
NodeName *string `json:"node_name,omitempty"`
InstanceID *string `json:"instance_id,omitempty"`
HostID *string `json:"host_id,omitempty"`
WorkflowInstanceID *string `json:"workflow_instance_id,omitempty"`
WorkflowExecutionID *string `json:"workflow_execution_id,omitempty"`
CompletedAt *time.Time `json:"completed_at,omitempty"`
Status *Status `json:"status,omitempty"`
Error *string `json:"error,omitempty"`
}
func UpdateCancel ¶
func UpdateCancel() UpdateOptions
func UpdateComplete ¶
func UpdateComplete() UpdateOptions
func UpdateFail ¶
func UpdateFail(cause error) UpdateOptions
func UpdateStart ¶
func UpdateStart() UpdateOptions