Documentation ¶
Index ¶
- Constants
- Variables
- func WithOperation(oplog *oplog.OpLog, op *v1.Operation, do func() error) error
- type BackupTask
- type CollectGarbageTask
- type ForgetTask
- type IndexSnapshotsTask
- type Orchestrator
- func (o *Orchestrator) ApplyConfig(cfg *v1.Config) error
- func (o *Orchestrator) CancelOperation(operationId int64, status v1.OperationStatus) error
- func (o *Orchestrator) GetPlan(planId string) (*v1.Plan, error)
- func (o *Orchestrator) GetRepo(repoId string) (repo *RepoOrchestrator, err error)
- func (o *Orchestrator) Run(mainCtx context.Context)
- func (o *Orchestrator) ScheduleTask(t Task, priority int)
- type PruneTask
- type RepoOrchestrator
- func (r *RepoOrchestrator) Backup(ctx context.Context, plan *v1.Plan, ...) (*restic.BackupProgressEntry, error)
- func (r *RepoOrchestrator) Forget(ctx context.Context, plan *v1.Plan) ([]*v1.ResticSnapshot, error)
- func (r *RepoOrchestrator) ListSnapshotFiles(ctx context.Context, snapshotId string, path string) ([]*v1.LsEntry, error)
- func (r *RepoOrchestrator) Prune(ctx context.Context, output io.Writer) error
- func (r *RepoOrchestrator) Restore(ctx context.Context, snapshotId string, path string, target string, ...) (*v1.RestoreProgressEntry, error)
- func (r *RepoOrchestrator) Snapshots(ctx context.Context) ([]*restic.Snapshot, error)
- func (r *RepoOrchestrator) SnapshotsForPlan(ctx context.Context, plan *v1.Plan) ([]*restic.Snapshot, error)
- func (r *RepoOrchestrator) Stats(ctx context.Context) (*v1.RepoStats, error)
- func (r *RepoOrchestrator) Unlock(ctx context.Context) error
- type RestoreTask
- type RestoreTaskOpts
- type StatsTask
- type Task
- type TaskWithOperation
Constants ¶
View Source
const ( TaskPriorityDefault = 0 TaskPriorityInteractive = 10 TaskPriorityIndexSnapshots = 101 TaskPriorityForget = 102 TaskPriorityPrune = 103 TaskPriorityStats = -1 // very low priority. )
Variables ¶
View Source
var ErrPlanNotFound = errors.New("plan not found")
View Source
var ErrRepoInitializationFailed = errors.New("repo initialization failed")
View Source
var ErrRepoNotFound = errors.New("repo not found")
Functions ¶
Types ¶
type BackupTask ¶
type BackupTask struct { TaskWithOperation // contains filtered or unexported fields }
BackupTask is a scheduled backup operation.
func NewOneoffBackupTask ¶ added in v0.8.2
func NewOneoffBackupTask(orchestrator *Orchestrator, plan *v1.Plan, at time.Time) *BackupTask
func NewScheduledBackupTask ¶
func NewScheduledBackupTask(orchestrator *Orchestrator, plan *v1.Plan) (*BackupTask, error)
func (*BackupTask) Name ¶
func (t *BackupTask) Name() string
type CollectGarbageTask ¶
type CollectGarbageTask struct {
// contains filtered or unexported fields
}
func (*CollectGarbageTask) Cancel ¶
func (t *CollectGarbageTask) Cancel(withStatus v1.OperationStatus) error
func (*CollectGarbageTask) Name ¶
func (t *CollectGarbageTask) Name() string
func (*CollectGarbageTask) OperationId ¶
func (t *CollectGarbageTask) OperationId() int64
type ForgetTask ¶
type ForgetTask struct { TaskWithOperation // contains filtered or unexported fields }
ForgetTask tracks a forget operation.
func NewOneoffForgetTask ¶ added in v0.8.2
func NewOneoffForgetTask(orchestrator *Orchestrator, plan *v1.Plan, linkSnapshot string, at time.Time) *ForgetTask
func (*ForgetTask) Name ¶
func (t *ForgetTask) Name() string
type IndexSnapshotsTask ¶
type IndexSnapshotsTask struct {
// contains filtered or unexported fields
}
IndexSnapshotsTask tracks a forget operation.
func NewOneoffIndexSnapshotsTask ¶ added in v0.8.2
func NewOneoffIndexSnapshotsTask(orchestrator *Orchestrator, plan *v1.Plan, at time.Time) *IndexSnapshotsTask
func (*IndexSnapshotsTask) Cancel ¶
func (t *IndexSnapshotsTask) Cancel(withStatus v1.OperationStatus) error
func (*IndexSnapshotsTask) Name ¶
func (t *IndexSnapshotsTask) Name() string
func (*IndexSnapshotsTask) OperationId ¶
func (t *IndexSnapshotsTask) OperationId() int64
type Orchestrator ¶
Orchestrator is responsible for managing repos and backups.
func NewOrchestrator ¶
func (*Orchestrator) ApplyConfig ¶
func (o *Orchestrator) ApplyConfig(cfg *v1.Config) error
func (*Orchestrator) CancelOperation ¶
func (o *Orchestrator) CancelOperation(operationId int64, status v1.OperationStatus) error
func (*Orchestrator) GetRepo ¶
func (o *Orchestrator) GetRepo(repoId string) (repo *RepoOrchestrator, err error)
func (*Orchestrator) Run ¶
func (o *Orchestrator) Run(mainCtx context.Context)
Run is the main orchestration loop. Cancel the context to stop the loop.
func (*Orchestrator) ScheduleTask ¶
func (o *Orchestrator) ScheduleTask(t Task, priority int)
type PruneTask ¶
type PruneTask struct { TaskWithOperation // contains filtered or unexported fields }
PruneTask tracks a forget operation.
func NewOneoffPruneTask ¶ added in v0.8.2
type RepoOrchestrator ¶
type RepoOrchestrator struct {
// contains filtered or unexported fields
}
RepoOrchestrator is responsible for managing a single repo.
func (*RepoOrchestrator) Backup ¶
func (r *RepoOrchestrator) Backup(ctx context.Context, plan *v1.Plan, progressCallback func(event *restic.BackupProgressEntry)) (*restic.BackupProgressEntry, error)
func (*RepoOrchestrator) Forget ¶
func (r *RepoOrchestrator) Forget(ctx context.Context, plan *v1.Plan) ([]*v1.ResticSnapshot, error)
func (*RepoOrchestrator) ListSnapshotFiles ¶
func (*RepoOrchestrator) Restore ¶
func (r *RepoOrchestrator) Restore(ctx context.Context, snapshotId string, path string, target string, progressCallback func(event *v1.RestoreProgressEntry)) (*v1.RestoreProgressEntry, error)
func (*RepoOrchestrator) SnapshotsForPlan ¶
type RestoreTask ¶
type RestoreTask struct { TaskWithOperation // contains filtered or unexported fields }
RestoreTask tracks a forget operation.
func NewOneoffRestoreTask ¶ added in v0.8.2
func NewOneoffRestoreTask(orchestrator *Orchestrator, opts RestoreTaskOpts, at time.Time) *RestoreTask
func (*RestoreTask) Name ¶
func (t *RestoreTask) Name() string
type RestoreTaskOpts ¶
type StatsTask ¶ added in v0.8.0
type StatsTask struct { TaskWithOperation // contains filtered or unexported fields }
StatsTask tracks a restic stats operation.
func NewOneoffStatsTask ¶ added in v0.8.2
type Task ¶
type Task interface { Name() string // huamn readable name for this task. Next(now time.Time) *time.Time // when this task would like to be run. Run(ctx context.Context) error // run the task. Cancel(withStatus v1.OperationStatus) error // informat the task that it's scheduled execution will be skipped (either STATUS_USER_CANCELLED or STATUS_SYSTEM_CANCELLED). OperationId() int64 // the id of the operation associated with this task (if any). }
type TaskWithOperation ¶
type TaskWithOperation struct {
// contains filtered or unexported fields
}
func (*TaskWithOperation) Cancel ¶
func (t *TaskWithOperation) Cancel(withStatus v1.OperationStatus) error
Cancel marks a task as cancelled. Note that, unintuitively, it is actually an error to call cancel on a running task.
func (*TaskWithOperation) OperationId ¶
func (t *TaskWithOperation) OperationId() int64
Click to show internal directories.
Click to hide internal directories.