Documentation ¶
Index ¶
- Variables
- func ValidateSnapshotId(id string) error
- type BackupOption
- type BackupOpts
- type BackupProgressEntry
- type CmdError
- type ForgetResult
- type GenericOption
- type GenericOpts
- type LsEntry
- type Repo
- func (r *Repo) Backup(ctx context.Context, progressCallback func(*BackupProgressEntry), ...) (*BackupProgressEntry, error)
- func (r *Repo) Forget(ctx context.Context, policy *RetentionPolicy, opts ...GenericOption) (*ForgetResult, error)
- func (r *Repo) ForgetSnapshot(ctx context.Context, snapshotId string, opts ...GenericOption) error
- func (r *Repo) Init(ctx context.Context, opts ...GenericOption) error
- func (r *Repo) ListDirectory(ctx context.Context, snapshot string, path string, opts ...GenericOption) (*Snapshot, []*LsEntry, error)
- func (r *Repo) Prune(ctx context.Context, pruneOutput io.Writer, opts ...GenericOption) error
- func (r *Repo) Restore(ctx context.Context, snapshot string, callback func(*RestoreProgressEntry), ...) (*RestoreProgressEntry, error)
- func (r *Repo) Snapshots(ctx context.Context, opts ...GenericOption) ([]*Snapshot, error)
- func (r *Repo) Stats(ctx context.Context, opts ...GenericOption) (*RepoStats, error)
- func (r *Repo) Unlock(ctx context.Context, opts ...GenericOption) error
- type RepoStats
- type RestoreProgressEntry
- type RetentionPolicy
- type Snapshot
Constants ¶
This section is empty.
Variables ¶
View Source
var EnvToPropagate = []string{
"PATH", "HOME", "XDG_CACHE_HOME", "XDG_CONFIG_HOME", "XDG_DATA_HOME",
"APPDATA", "LOCALAPPDATA",
}
View Source
var ErrBackupFailed = errors.New("backup failed")
View Source
var ErrPartialBackup = errors.New("incomplete backup")
Functions ¶
func ValidateSnapshotId ¶
Types ¶
type BackupOption ¶
type BackupOption func(opts *BackupOpts)
func WithBackupExcludes ¶
func WithBackupExcludes(excludes ...string) BackupOption
func WithBackupParent ¶
func WithBackupParent(parent string) BackupOption
func WithBackupPaths ¶
func WithBackupPaths(paths ...string) BackupOption
func WithBackupTags ¶
func WithBackupTags(tags ...string) BackupOption
type BackupOpts ¶
type BackupOpts struct {
// contains filtered or unexported fields
}
type BackupProgressEntry ¶
type BackupProgressEntry struct { // Common fields MessageType string `json:"message_type"` // "summary" or "status" // Summary fields FilesNew int `json:"files_new"` FilesChanged int `json:"files_changed"` FilesUnmodified int `json:"files_unmodified"` DirsNew int `json:"dirs_new"` DirsChanged int `json:"dirs_changed"` DirsUnmodified int `json:"dirs_unmodified"` DataBlobs int `json:"data_blobs"` TreeBlobs int `json:"tree_blobs"` DataAdded int `json:"data_added"` TotalFilesProcessed int `json:"total_files_processed"` TotalBytesProcessed int `json:"total_bytes_processed"` TotalDuration float64 `json:"total_duration"` SnapshotId string `json:"snapshot_id"` // Status fields PercentDone float64 `json:"percent_done"` TotalFiles int `json:"total_files"` FilesDone int `json:"files_done"` TotalBytes int `json:"total_bytes"` BytesDone int `json:"bytes_done"` CurrentFiles []string `json:"current_files"` }
func (*BackupProgressEntry) Validate ¶
func (b *BackupProgressEntry) Validate() error
type ForgetResult ¶
func (*ForgetResult) Validate ¶
func (r *ForgetResult) Validate() error
type GenericOption ¶
type GenericOption func(opts *GenericOpts)
func WithEnv ¶
func WithEnv(env ...string) GenericOption
func WithEnviron ¶ added in v0.11.0
func WithEnviron() GenericOption
func WithFlags ¶
func WithFlags(flags ...string) GenericOption
func WithPropagatedEnvVars ¶
func WithPropagatedEnvVars(extras ...string) GenericOption
func WithTags ¶
func WithTags(tags ...string) GenericOption
type GenericOpts ¶
type GenericOpts struct {
// contains filtered or unexported fields
}
type LsEntry ¶
type Repo ¶
type Repo struct {
// contains filtered or unexported fields
}
func NewRepo ¶
func NewRepo(resticBin string, repo *v1.Repo, opts ...GenericOption) *Repo
NewRepo instantiates a new repository. TODO: should not accept a v1.Repo, should instead be configured by parameters.
func (*Repo) Backup ¶
func (r *Repo) Backup(ctx context.Context, progressCallback func(*BackupProgressEntry), opts ...BackupOption) (*BackupProgressEntry, error)
func (*Repo) Forget ¶
func (r *Repo) Forget(ctx context.Context, policy *RetentionPolicy, opts ...GenericOption) (*ForgetResult, error)
func (*Repo) ForgetSnapshot ¶ added in v0.12.0
func (*Repo) ListDirectory ¶
func (*Repo) Restore ¶
func (r *Repo) Restore(ctx context.Context, snapshot string, callback func(*RestoreProgressEntry), opts ...GenericOption) (*RestoreProgressEntry, error)
type RepoStats ¶ added in v0.8.0
type RepoStats struct { TotalSize int64 `json:"total_size"` TotalUncompressedSize int64 `json:"total_uncompressed_size"` CompressionRatio float64 `json:"compression_ratio"` CompressionProgress int64 `json:"compression_progress"` CompressionSpaceSaving float64 `json:"compression_space_saving"` TotalBlobCount int64 `json:"total_blob_count"` SnapshotsCount int64 `json:"snapshots_count"` }
type RestoreProgressEntry ¶
type RestoreProgressEntry struct { MessageType string `json:"message_type"` // "summary" or "status" SecondsElapsed float64 `json:"seconds_elapsed"` TotalBytes int64 `json:"total_bytes"` BytesRestored int64 `json:"bytes_restored"` TotalFiles int64 `json:"total_files"` FilesRestored int64 `json:"files_restored"` PercentDone float64 `json:"percent_done"` }
func (*RestoreProgressEntry) Validate ¶
func (e *RestoreProgressEntry) Validate() error
type RetentionPolicy ¶
type RetentionPolicy struct { KeepLastN int // keep the last n snapshots. KeepHourly int // keep the last n hourly snapshots. KeepDaily int // keep the last n daily snapshots. KeepWeekly int // keep the last n weekly snapshots. KeepMonthly int // keep the last n monthly snapshots. KeepYearly int // keep the last n yearly snapshots. KeepWithinDuration string // keep snapshots within a duration e.g. 1y2m3d4h5m6s }
type Snapshot ¶
type Snapshot struct { Id string `json:"id"` Time string `json:"time"` Tree string `json:"tree"` Paths []string `json:"paths"` Hostname string `json:"hostname"` Username string `json:"username"` Tags []string `json:"tags"` Parent string `json:"parent"` // contains filtered or unexported fields }
func (*Snapshot) UnixTimeMs ¶
Click to show internal directories.
Click to hide internal directories.