Documentation
¶
Index ¶
- Variables
- func BuildComponents(project *composeProject, stackPath, backupLocation string) ([]Component, []SkippedMount, error)
- func RunStartupHygiene(lc fx.Lifecycle, service *Service)
- type AbandonBackupStorageResult
- type BackupPruneStatus
- type BrowseRequest
- type Component
- type ComponentKind
- type CreateOptions
- type DeleteAllBackupsRequest
- type DeleteAllBackupsResult
- type DeleteBackupRequest
- type DeleteStackBackupsResult
- type FileEntry
- type FileListing
- type Handler
- func (h *Handler) AbandonBackupStorage(c echo.Context) error
- func (h *Handler) DeleteAllBackups(c echo.Context) error
- func (h *Handler) DeleteStackBackup(c echo.Context) error
- func (h *Handler) DownloadBackupFiles(c echo.Context) error
- func (h *Handler) GetBackupHistory(c echo.Context) error
- func (h *Handler) GetBackupsOverview(c echo.Context) error
- func (h *Handler) GetStackBackup(c echo.Context) error
- func (h *Handler) ListBackupFiles(c echo.Context) error
- func (h *Handler) ListStackBackups(c echo.Context) error
- func (h *Handler) RebuildStackIndex(c echo.Context) error
- type HistoryState
- type ListBackupsResponse
- type OperationReservation
- type Overview
- type ProgressWriter
- type RebuildRequest
- type RebuildResult
- type RestoreOptions
- type Run
- type RunPersistence
- func (p *RunPersistence) DeleteRun(stackName, runID string) error
- func (p *RunPersistence) HasRecordedSnapshots(stackName string) (bool, error)
- func (p *RunPersistence) ListStacksWithRuns() ([]string, error)
- func (p *RunPersistence) LoadRun(stackName, runID string) (*Run, error)
- func (p *RunPersistence) LoadStackRuns(stackName string) ([]*Run, error)
- func (p *RunPersistence) PersistRun(run *Run) error
- func (p *RunPersistence) RunSummaries(stackName string) ([]RunSummary, error)
- type RunStatus
- type RunSummary
- type S3Repository
- type Service
- func (s *Service) AbandonBackupStorage(ctx context.Context) (AbandonBackupStorageResult, error)
- func (s *Service) ArchiveBackupFiles(ctx context.Context, stackName, backupID, componentID string, ...) error
- func (s *Service) BackupHistory() (HistoryState, error)
- func (s *Service) BuildOverview() (*Overview, error)
- func (s *Service) Configured() bool
- func (s *Service) CreateBackup(ctx context.Context, stackName, stackPath string, opts CreateOptions, ...) error
- func (s *Service) DeleteAllBackups(ctx context.Context, password string, s3RepositoryBase *S3Repository) (DeleteAllBackupsResult, error)
- func (s *Service) DeleteBackup(ctx context.Context, stackName, backupID, password string, ...) error
- func (s *Service) DumpBackupFile(ctx context.Context, ...) error
- func (s *Service) GetRun(stackName, runID string) (*Run, error)
- func (s *Service) ListBackupFiles(ctx context.Context, ...) (*FileListing, error)
- func (s *Service) ListRunSummaries(stackName string, limit, offset int) (int, []RunSummary, error)
- func (s *Service) MarkInterruptedRuns()
- func (s *Service) RebuildIndex(ctx context.Context, stackName, password string, s3Repo *S3Repository, ...) (RebuildResult, error)
- func (s *Service) RemoveOrphanedHelpers(ctx context.Context)
- func (s *Service) ReserveOperation() (OperationReservation, error)
- func (s *Service) RestoreBackup(ctx context.Context, stackName, stackPath string, opts RestoreOptions, ...) error
- func (s *Service) StatBackupFiles(ctx context.Context, stackName, backupID, componentID string, ...) ([]FileEntry, error)
- type SkippedMount
- type StackBackupSummary
- type VolumeDefinition
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrComponentNotFound = errors.New("the backup has no such component with a snapshot")
View Source
var ErrInvalidS3Repository = errors.New("invalid s3 repository")
View Source
var ErrPathNotFound = errors.New("the backup does not contain that path")
View Source
var ErrRepositoryBusy = errors.New("the backup repository is in use by another operation; try again once it finishes")
View Source
var ErrRunNotFound = errors.New("backup run not found")
View Source
var Module = fx.Options( fx.Provide(NewServiceWithConfig), fx.Provide(NewHandler), fx.Invoke(RunStartupHygiene), )
Functions ¶
func BuildComponents ¶
func BuildComponents(project *composeProject, stackPath, backupLocation string) ([]Component, []SkippedMount, error)
func RunStartupHygiene ¶
Types ¶
type AbandonBackupStorageResult ¶ added in v0.5.2
type AbandonBackupStorageResult struct {
Complete bool `json:"complete"`
Before HistoryState `json:"before"`
After HistoryState `json:"after"`
Errors []string `json:"errors"`
}
type BackupPruneStatus ¶ added in v0.5.2
type BackupPruneStatus string
const ( BackupPruneNotNeeded BackupPruneStatus = "not_needed" BackupPruneNotAttempted BackupPruneStatus = "not_attempted" BackupPruneSucceeded BackupPruneStatus = "succeeded" BackupPruneFailed BackupPruneStatus = "failed" )
type BrowseRequest ¶ added in v0.5.2
type BrowseRequest struct {
BackupPassword string `json:"backup_password"`
Repository *S3Repository `json:"s3_repository,omitempty"`
}
type Component ¶
type Component struct {
ID string `json:"id"`
Kind ComponentKind `json:"kind"`
VolumeName string `json:"volume_name,omitempty"`
VolumeDef *VolumeDefinition `json:"volume_def,omitempty"`
SourcePath string `json:"source_path,omitempty"`
Service string `json:"service,omitempty"`
Target string `json:"target,omitempty"`
ContainerNumber string `json:"container_number,omitempty"`
IsFile bool `json:"is_file,omitempty"`
Excludes []string `json:"excludes,omitempty"`
SnapshotID string `json:"snapshot_id,omitempty"`
FilesNew uint64 `json:"files_new"`
FilesChanged uint64 `json:"files_changed"`
FilesUnmodified uint64 `json:"files_unmodified"`
BytesAdded uint64 `json:"bytes_added"`
BytesProcessed uint64 `json:"bytes_processed"`
DurationSecs float64 `json:"duration_secs"`
Error string `json:"error,omitempty"`
}
type ComponentKind ¶
type ComponentKind string
const ( KindStackDirectory ComponentKind = "stack-directory" KindVolume ComponentKind = "volume" KindBindMount ComponentKind = "bind-mount" KindAnonymousVolume ComponentKind = "anonymous-volume" )
type CreateOptions ¶
type CreateOptions struct {
StopMode string
Label string
Password string
Repository *S3Repository
}
type DeleteAllBackupsRequest ¶ added in v0.5.2
type DeleteAllBackupsRequest struct {
BackupPassword string `json:"backup_password"`
S3RepositoryBase *S3Repository `json:"s3_repository_base,omitempty"`
}
type DeleteAllBackupsResult ¶ added in v0.5.2
type DeleteAllBackupsResult struct {
Complete bool `json:"complete"`
Before HistoryState `json:"before"`
After HistoryState `json:"after"`
Stacks []DeleteStackBackupsResult `json:"stacks"`
Errors []string `json:"errors"`
}
type DeleteBackupRequest ¶
type DeleteBackupRequest struct {
BackupPassword string `json:"backup_password"`
Repository *S3Repository `json:"s3_repository,omitempty"`
}
type DeleteStackBackupsResult ¶ added in v0.5.2
type DeleteStackBackupsResult struct {
StackName string `json:"stack_name"`
Attempted bool `json:"attempted"`
RecordsBefore int `json:"records_before"`
RecordsDeleted int `json:"records_deleted"`
RecordsRemaining int `json:"records_remaining"`
SnapshotsForgotten int `json:"snapshots_forgotten"`
PruneStatus BackupPruneStatus `json:"prune_status"`
Errors []string `json:"errors"`
}
type FileListing ¶
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) AbandonBackupStorage ¶ added in v0.5.2
func (*Handler) DeleteAllBackups ¶ added in v0.5.2
func (*Handler) GetBackupHistory ¶ added in v0.5.2
type HistoryState ¶ added in v0.5.2
type ListBackupsResponse ¶
type ListBackupsResponse struct {
Configured bool `json:"configured"`
Total int `json:"total"`
Runs []RunSummary `json:"runs"`
}
type OperationReservation ¶ added in v0.5.2
type OperationReservation interface {
CreateBackup(context.Context, string, string, CreateOptions, ProgressWriter) error
RestoreBackup(context.Context, string, string, RestoreOptions, ProgressWriter) error
Release()
}
type Overview ¶
type Overview struct {
Configured bool `json:"configured"`
Stacks []StackBackupSummary `json:"stacks"`
}
type ProgressWriter ¶
type RebuildRequest ¶ added in v0.5.2
type RebuildRequest struct {
BackupPassword string `json:"backup_password"`
Repository *S3Repository `json:"s3_repository,omitempty"`
}
type RebuildResult ¶ added in v0.5.2
type RestoreOptions ¶
type Run ¶
type Run struct {
ID string `json:"id"`
StackName string `json:"stack_name"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Status RunStatus `json:"status"`
Label string `json:"label,omitempty"`
StopMode string `json:"stop_mode,omitempty"`
ResticVersion string `json:"restic_version,omitempty"`
Verified *bool `json:"verified,omitempty"`
VerifyError string `json:"verify_error,omitempty"`
RepoSizeBytes uint64 `json:"repo_size_bytes,omitempty"`
Components []Component `json:"components"`
Skipped []SkippedMount `json:"skipped,omitempty"`
Error string `json:"error,omitempty"`
}
type RunPersistence ¶
type RunPersistence struct {
// contains filtered or unexported fields
}
func NewRunPersistence ¶
func NewRunPersistence(persistenceDir string, logger *logging.Logger) (*RunPersistence, error)
func (*RunPersistence) DeleteRun ¶
func (p *RunPersistence) DeleteRun(stackName, runID string) error
func (*RunPersistence) HasRecordedSnapshots ¶
func (p *RunPersistence) HasRecordedSnapshots(stackName string) (bool, error)
func (*RunPersistence) ListStacksWithRuns ¶
func (p *RunPersistence) ListStacksWithRuns() ([]string, error)
func (*RunPersistence) LoadRun ¶
func (p *RunPersistence) LoadRun(stackName, runID string) (*Run, error)
func (*RunPersistence) LoadStackRuns ¶
func (p *RunPersistence) LoadStackRuns(stackName string) ([]*Run, error)
func (*RunPersistence) PersistRun ¶
func (p *RunPersistence) PersistRun(run *Run) error
func (*RunPersistence) RunSummaries ¶
func (p *RunPersistence) RunSummaries(stackName string) ([]RunSummary, error)
type RunSummary ¶
type RunSummary struct {
ID string `json:"id"`
StackName string `json:"stack_name"`
StartedAt time.Time `json:"started_at"`
FinishedAt *time.Time `json:"finished_at,omitempty"`
Status RunStatus `json:"status"`
Label string `json:"label,omitempty"`
StopMode string `json:"stop_mode,omitempty"`
Verified *bool `json:"verified,omitempty"`
RepoSizeBytes uint64 `json:"repo_size_bytes,omitempty"`
SizeBytes uint64 `json:"size_bytes"`
AddedBytes uint64 `json:"added_bytes"`
ComponentCount int `json:"component_count"`
ComponentsWithErrors int `json:"components_with_errors"`
}
func SummariseRun ¶
func SummariseRun(run *Run) RunSummary
type S3Repository ¶ added in v0.5.2
type S3Repository struct {
URL string `json:"url"`
AccessKeyID string `json:"access_key_id"`
SecretKey string `json:"secret_access_key"`
Region string `json:"region,omitempty"`
}
func (*S3Repository) Validate ¶ added in v0.5.2
func (r *S3Repository) Validate() error
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
func NewService ¶
func NewServiceWithConfig ¶
func (*Service) AbandonBackupStorage ¶ added in v0.5.2
func (s *Service) AbandonBackupStorage(ctx context.Context) (AbandonBackupStorageResult, error)
func (*Service) ArchiveBackupFiles ¶
func (*Service) BackupHistory ¶ added in v0.5.2
func (s *Service) BackupHistory() (HistoryState, error)
func (*Service) BuildOverview ¶
func (*Service) Configured ¶
func (*Service) CreateBackup ¶
func (s *Service) CreateBackup(ctx context.Context, stackName, stackPath string, opts CreateOptions, writer ProgressWriter) error
func (*Service) DeleteAllBackups ¶ added in v0.5.2
func (s *Service) DeleteAllBackups(ctx context.Context, password string, s3RepositoryBase *S3Repository) (DeleteAllBackupsResult, error)
func (*Service) DeleteBackup ¶
func (*Service) DumpBackupFile ¶
func (*Service) ListBackupFiles ¶
func (s *Service) ListBackupFiles(ctx context.Context, stackName, backupID, componentID, relPath, password string, s3Repo *S3Repository) (*FileListing, error)
func (*Service) ListRunSummaries ¶
func (*Service) MarkInterruptedRuns ¶
func (s *Service) MarkInterruptedRuns()
func (*Service) RebuildIndex ¶ added in v0.5.2
func (s *Service) RebuildIndex(ctx context.Context, stackName, password string, s3Repo *S3Repository, writer ProgressWriter) (RebuildResult, error)
func (*Service) RemoveOrphanedHelpers ¶
func (*Service) ReserveOperation ¶ added in v0.5.2
func (s *Service) ReserveOperation() (OperationReservation, error)
func (*Service) RestoreBackup ¶
func (s *Service) RestoreBackup(ctx context.Context, stackName, stackPath string, opts RestoreOptions, writer ProgressWriter) error
type SkippedMount ¶
type StackBackupSummary ¶
type StackBackupSummary struct {
StackName string `json:"stack_name"`
StackExists bool `json:"stack_exists"`
RunCount int `json:"run_count"`
LatestRun *RunSummary `json:"latest_run,omitempty"`
RepoSizeBytes uint64 `json:"repo_size_bytes,omitempty"`
}
Click to show internal directories.
Click to hide internal directories.