Documentation
¶
Overview ¶
Package systembackup owns Arcane system-recovery backup orchestration and its HTTP surface.
Index ¶
- Variables
- func RegisterSystemBackups(api huma.API, service *SystemBackupService, ...)
- type CreateSystemBackupInput
- type DeleteSystemBackupInput
- type DiscoverSystemBackupsInput
- type DiscoverSystemBackupsOutput
- type GenerateSystemBackupRecoveryKeyOutput
- type ListSystemBackupsInput
- type ListSystemBackupsOutput
- type Module
- type RestoreSystemBackupInput
- type SetSystemBackupRecoveryKeyInput
- type SystemBackupHandler
- func (h *SystemBackupHandler) Create(ctx context.Context, input *CreateSystemBackupInput) (*SystemBackupOutput, error)
- func (h *SystemBackupHandler) Delete(ctx context.Context, input *DeleteSystemBackupInput) (*SystemBackupMessageOutput, error)
- func (h *SystemBackupHandler) Discover(ctx context.Context, input *DiscoverSystemBackupsInput) (*DiscoverSystemBackupsOutput, error)
- func (h *SystemBackupHandler) GenerateRecoveryKey(_ context.Context, _ *struct{}) (*GenerateSystemBackupRecoveryKeyOutput, error)
- func (h *SystemBackupHandler) GetPolicies(ctx context.Context, _ *struct{}) (*SystemBackupPoliciesOutput, error)
- func (h *SystemBackupHandler) List(ctx context.Context, input *ListSystemBackupsInput) (*ListSystemBackupsOutput, error)
- func (h *SystemBackupHandler) Restore(ctx context.Context, input *RestoreSystemBackupInput) (*SystemBackupMessageOutput, error)
- func (h *SystemBackupHandler) SetRecoveryKey(ctx context.Context, input *SetSystemBackupRecoveryKeyInput) (*SystemBackupRecoveryKeyOutput, error)
- func (h *SystemBackupHandler) UpdatePolicies(ctx context.Context, input *UpdateSystemBackupPoliciesInput) (*SystemBackupPoliciesOutput, error)
- func (h *SystemBackupHandler) Upload(ctx context.Context, input *UploadSystemBackupInput) (*SystemBackupOutput, error)
- type SystemBackupMessageOutput
- type SystemBackupOutput
- type SystemBackupPoliciesOutput
- type SystemBackupPolicy
- type SystemBackupRecoveryConfig
- type SystemBackupRecoveryKeyOutput
- type SystemBackupRun
- type SystemBackupService
- func (s *SystemBackupService) CreateBackup(ctx context.Context, user common.User, trigger SystemBackupTrigger, ...) (_ *SystemBackupRun, err error)
- func (s *SystemBackupService) DeleteBackup(ctx context.Context, id, recoveryKey string) error
- func (s *SystemBackupService) DiscoverRemoteBackups(ctx context.Context, request backuptypes.DiscoverSystemBackupsRequest) (int, error)
- func (s *SystemBackupService) GenerateRecoveryKey() (*backuptypes.SystemBackupRecoveryKey, error)
- func (s *SystemBackupService) GetPolicies(ctx context.Context) (*backuptypes.SystemBackupPolicyCollection, error)
- func (s *SystemBackupService) ListBackups(ctx context.Context, params pagination.QueryParams) ([]backuptypes.SystemBackupRun, pagination.Response, error)
- func (s *SystemBackupService) RegisterBackupJobOnStartup(ctx context.Context)
- func (s *SystemBackupService) RestoreBackup(ctx context.Context, id, recoveryKey string, user common.User) error
- func (s *SystemBackupService) SetRecoveryKey(ctx context.Context, recoveryKey string) (*backuptypes.SystemBackupRecoveryKeyStatus, error)
- func (s *SystemBackupService) SetScheduler(ctx context.Context, scheduler schedulertypes.DynamicScheduler, ...) error
- func (s *SystemBackupService) SupportedDatabaseProvider() bool
- func (s *SystemBackupService) UpdatePolicies(ctx context.Context, updates []backuptypes.UpdateSystemBackupPolicy) (*backuptypes.SystemBackupPolicyCollection, error)
- func (s *SystemBackupService) UploadBackup(ctx context.Context, id string, request backuptypes.UploadSystemBackupRequest) (*SystemBackupRun, error)
- type SystemBackupStatus
- type SystemBackupTrigger
- type UpdateSystemBackupPoliciesInput
- type UploadSystemBackupInput
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrSystemBackupAlreadyRunning = errors.New("an Arcane system backup is already running")
Functions ¶
func RegisterSystemBackups ¶
func RegisterSystemBackups(api huma.API, service *SystemBackupService, activityService *activity.ActivityService, appCtx handlerutil.ActivityAppContext)
Types ¶
type CreateSystemBackupInput ¶
type CreateSystemBackupInput struct {
Body backuptypes.CreateSystemBackupRequest
}
type DeleteSystemBackupInput ¶
type DeleteSystemBackupInput struct {
ID string `path:"id"`
Body backuptypes.DeleteSystemBackupRequest
}
type DiscoverSystemBackupsInput ¶
type DiscoverSystemBackupsInput struct {
Body backuptypes.DiscoverSystemBackupsRequest
}
type DiscoverSystemBackupsOutput ¶
type DiscoverSystemBackupsOutput struct{ Body base.ApiResponse[int] }
type GenerateSystemBackupRecoveryKeyOutput ¶
type GenerateSystemBackupRecoveryKeyOutput struct {
Body backuptypes.SystemBackupRecoveryKey
}
type ListSystemBackupsInput ¶
type ListSystemBackupsOutput ¶
type ListSystemBackupsOutput struct {
Body struct {
Data []backuptypes.SystemBackupRun `json:"data"`
Pagination base.PaginationResponse `json:"pagination"`
}
}
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func New ¶
func New(service *SystemBackupService, activityService *activity.ActivityService) *Module
func (*Module) RegisterRoutes ¶
func (m *Module) RegisterRoutes(api huma.API, appCtx handlerutil.ActivityAppContext)
func (*Module) Service ¶
func (m *Module) Service() *SystemBackupService
type RestoreSystemBackupInput ¶
type RestoreSystemBackupInput struct {
ID string `path:"id"`
Body backuptypes.RestoreSystemBackupRequest
}
type SetSystemBackupRecoveryKeyInput ¶
type SetSystemBackupRecoveryKeyInput struct {
Body backuptypes.SystemBackupRecoveryKey
}
type SystemBackupHandler ¶
type SystemBackupHandler struct {
// contains filtered or unexported fields
}
func (*SystemBackupHandler) Create ¶
func (h *SystemBackupHandler) Create(ctx context.Context, input *CreateSystemBackupInput) (*SystemBackupOutput, error)
func (*SystemBackupHandler) Delete ¶
func (h *SystemBackupHandler) Delete(ctx context.Context, input *DeleteSystemBackupInput) (*SystemBackupMessageOutput, error)
func (*SystemBackupHandler) Discover ¶
func (h *SystemBackupHandler) Discover(ctx context.Context, input *DiscoverSystemBackupsInput) (*DiscoverSystemBackupsOutput, error)
func (*SystemBackupHandler) GenerateRecoveryKey ¶
func (h *SystemBackupHandler) GenerateRecoveryKey(_ context.Context, _ *struct{}) (*GenerateSystemBackupRecoveryKeyOutput, error)
func (*SystemBackupHandler) GetPolicies ¶
func (h *SystemBackupHandler) GetPolicies(ctx context.Context, _ *struct{}) (*SystemBackupPoliciesOutput, error)
func (*SystemBackupHandler) List ¶
func (h *SystemBackupHandler) List(ctx context.Context, input *ListSystemBackupsInput) (*ListSystemBackupsOutput, error)
func (*SystemBackupHandler) Restore ¶
func (h *SystemBackupHandler) Restore(ctx context.Context, input *RestoreSystemBackupInput) (*SystemBackupMessageOutput, error)
func (*SystemBackupHandler) SetRecoveryKey ¶
func (h *SystemBackupHandler) SetRecoveryKey(ctx context.Context, input *SetSystemBackupRecoveryKeyInput) (*SystemBackupRecoveryKeyOutput, error)
func (*SystemBackupHandler) UpdatePolicies ¶
func (h *SystemBackupHandler) UpdatePolicies(ctx context.Context, input *UpdateSystemBackupPoliciesInput) (*SystemBackupPoliciesOutput, error)
func (*SystemBackupHandler) Upload ¶
func (h *SystemBackupHandler) Upload(ctx context.Context, input *UploadSystemBackupInput) (*SystemBackupOutput, error)
type SystemBackupMessageOutput ¶
type SystemBackupMessageOutput struct {
Body base.ApiResponse[base.MessageResponse]
}
type SystemBackupOutput ¶
type SystemBackupOutput struct{ Body backuptypes.SystemBackupRun }
type SystemBackupPoliciesOutput ¶
type SystemBackupPoliciesOutput struct {
Body backuptypes.SystemBackupPolicyCollection
}
type SystemBackupPolicy ¶
type SystemBackupPolicy struct {
database.BaseModel
Enabled bool `gorm:"column:enabled;not null;default:false"`
Schedule string `gorm:"column:schedule;type:text;not null"`
RetentionCount int `gorm:"column:retention_count;not null;default:7"`
LocalEnabled bool `gorm:"column:local_enabled;not null;default:true"`
S3Enabled bool `gorm:"column:s3_enabled;not null;default:false"`
S3DestinationID string `gorm:"column:s3_destination_id;type:text;index"`
}
func (SystemBackupPolicy) TableName ¶
func (SystemBackupPolicy) TableName() string
func (SystemBackupPolicy) ToDTO ¶
func (p SystemBackupPolicy) ToDTO(lastRun *SystemBackupRun) backuptypes.SystemBackupPolicy
type SystemBackupRecoveryConfig ¶
type SystemBackupRecoveryConfig struct {
database.BaseModel
EncryptedRecoveryKey string `gorm:"column:encrypted_recovery_key;type:text;not null"`
}
func (SystemBackupRecoveryConfig) TableName ¶
func (SystemBackupRecoveryConfig) TableName() string
type SystemBackupRecoveryKeyOutput ¶
type SystemBackupRecoveryKeyOutput struct {
Body backuptypes.SystemBackupRecoveryKeyStatus
}
type SystemBackupRun ¶
type SystemBackupRun struct {
database.BaseModel
Size int64 `json:"size" gorm:"column:size" sortable:"true"`
CreatedAt time.Time `json:"createdAt" gorm:"column:created_at" sortable:"true"`
Status SystemBackupStatus `json:"status" gorm:"column:status;type:text;not null" sortable:"true"`
Trigger SystemBackupTrigger `json:"trigger" gorm:"column:trigger;type:text;not null" sortable:"true"`
Destination backuptypes.SystemBackupDestination `json:"destination" gorm:"column:destination;type:text;not null" sortable:"true"`
LocalSnapshotID string `json:"localSnapshotId,omitempty" gorm:"column:local_snapshot_id;type:text"`
RemoteSnapshotID string `json:"remoteSnapshotId,omitempty" gorm:"column:remote_snapshot_id;type:text"`
S3DestinationID string `json:"s3DestinationId,omitempty" gorm:"column:s3_destination_id;type:text;index"`
S3DestinationName string `json:"s3DestinationName,omitempty" gorm:"-"`
PolicyID string `json:"policyId,omitempty" gorm:"column:policy_id;type:text;index"`
Error string `json:"error,omitempty" gorm:"column:error;type:text"`
}
func (SystemBackupRun) TableName ¶
func (SystemBackupRun) TableName() string
func (SystemBackupRun) ToDTO ¶
func (b SystemBackupRun) ToDTO() backuptypes.SystemBackupRun
type SystemBackupService ¶
type SystemBackupService struct {
// contains filtered or unexported fields
}
func NewSystemBackupService ¶
func NewSystemBackupService(db *database.DB, dockerService *docker.DockerClientService, volumeService *volume.VolumeService, engine *backup.Engine, s3Destinations *s3domain.S3DestinationService, activityService *activity.ActivityService, cfg *config.Config) *SystemBackupService
func (*SystemBackupService) CreateBackup ¶
func (s *SystemBackupService) CreateBackup(ctx context.Context, user common.User, trigger SystemBackupTrigger, request backuptypes.CreateSystemBackupRequest) (_ *SystemBackupRun, err error)
func (*SystemBackupService) DeleteBackup ¶
func (s *SystemBackupService) DeleteBackup(ctx context.Context, id, recoveryKey string) error
func (*SystemBackupService) DiscoverRemoteBackups ¶
func (s *SystemBackupService) DiscoverRemoteBackups(ctx context.Context, request backuptypes.DiscoverSystemBackupsRequest) (int, error)
func (*SystemBackupService) GenerateRecoveryKey ¶
func (s *SystemBackupService) GenerateRecoveryKey() (*backuptypes.SystemBackupRecoveryKey, error)
func (*SystemBackupService) GetPolicies ¶
func (s *SystemBackupService) GetPolicies(ctx context.Context) (*backuptypes.SystemBackupPolicyCollection, error)
func (*SystemBackupService) ListBackups ¶
func (s *SystemBackupService) ListBackups(ctx context.Context, params pagination.QueryParams) ([]backuptypes.SystemBackupRun, pagination.Response, error)
func (*SystemBackupService) RegisterBackupJobOnStartup ¶
func (s *SystemBackupService) RegisterBackupJobOnStartup(ctx context.Context)
func (*SystemBackupService) RestoreBackup ¶
func (*SystemBackupService) SetRecoveryKey ¶
func (s *SystemBackupService) SetRecoveryKey(ctx context.Context, recoveryKey string) (*backuptypes.SystemBackupRecoveryKeyStatus, error)
func (*SystemBackupService) SetScheduler ¶
func (s *SystemBackupService) SetScheduler(ctx context.Context, scheduler schedulertypes.DynamicScheduler, admissionGate *actors.Gate[actors.AdmissionKey]) error
SetScheduler injects the dynamic scheduler and admission gate for per-policy system backup jobs. Agent mode leaves them unset.
func (*SystemBackupService) SupportedDatabaseProvider ¶
func (s *SystemBackupService) SupportedDatabaseProvider() bool
SupportedDatabaseProvider reports whether system recovery works on the configured database. Recovery is currently SQLite-only.
func (*SystemBackupService) UpdatePolicies ¶
func (s *SystemBackupService) UpdatePolicies(ctx context.Context, updates []backuptypes.UpdateSystemBackupPolicy) (*backuptypes.SystemBackupPolicyCollection, error)
func (*SystemBackupService) UploadBackup ¶
func (s *SystemBackupService) UploadBackup(ctx context.Context, id string, request backuptypes.UploadSystemBackupRequest) (*SystemBackupRun, error)
type SystemBackupStatus ¶
type SystemBackupStatus string
const ( SystemBackupStatusRunning SystemBackupStatus = "running" SystemBackupStatusSucceeded SystemBackupStatus = "succeeded" SystemBackupStatusFailed SystemBackupStatus = "failed" )
type SystemBackupTrigger ¶
type SystemBackupTrigger string
const ( SystemBackupTriggerManual SystemBackupTrigger = "manual" SystemBackupTriggerScheduled SystemBackupTrigger = "scheduled" SystemBackupTriggerSafety SystemBackupTrigger = "safety" )
type UpdateSystemBackupPoliciesInput ¶
type UpdateSystemBackupPoliciesInput struct {
Body backuptypes.UpdateSystemBackupPolicies
}
type UploadSystemBackupInput ¶
type UploadSystemBackupInput struct {
ID string `path:"id"`
Body backuptypes.UploadSystemBackupRequest
}
Click to show internal directories.
Click to hide internal directories.