Documentation ¶
Index ¶
- Variables
- func ContextWithLogger(ctx context.Context, logger io.Writer) context.Context
- func LoggerFromContext(ctx context.Context) io.Writer
- func ValidateSnapshotId(id string) error
- type BackupProgressEntry
- type CmdError
- type ErrorWithOutput
- type ForgetResult
- type GenericOption
- type GenericOpts
- type LsEntry
- type Repo
- func (r *Repo) AddTags(ctx context.Context, snapshotIDs []string, tags []string, ...) error
- func (r *Repo) Backup(ctx context.Context, paths []string, ...) (*BackupProgressEntry, error)
- func (r *Repo) Check(ctx context.Context, checkOutput io.Writer, opts ...GenericOption) error
- func (r *Repo) Exists(ctx context.Context, opts ...GenericOption) 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) GenericCommand(ctx context.Context, args []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
- type SnapshotSummary
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 ContextWithLogger ¶ added in v0.16.0
func ValidateSnapshotId ¶
Types ¶
type BackupProgressEntry ¶
type BackupProgressEntry struct { // Common fields MessageType string `json:"message_type"` // "summary" or "status" or "error" // Error fields Error any `json:"error"` During string `json:"during"` Item string `json:"item"` // Summary fields FilesNew int64 `json:"files_new"` FilesChanged int64 `json:"files_changed"` FilesUnmodified int64 `json:"files_unmodified"` DirsNew int64 `json:"dirs_new"` DirsChanged int64 `json:"dirs_changed"` DirsUnmodified int64 `json:"dirs_unmodified"` DataBlobs int64 `json:"data_blobs"` TreeBlobs int64 `json:"tree_blobs"` DataAdded int64 `json:"data_added"` TotalFilesProcessed int64 `json:"total_files_processed"` TotalBytesProcessed int64 `json:"total_bytes_processed"` TotalDuration float64 `json:"total_duration"` SnapshotId string `json:"snapshot_id"` // Status fields PercentDone float64 `json:"percent_done"` TotalFiles int64 `json:"total_files"` FilesDone int64 `json:"files_done"` TotalBytes int64 `json:"total_bytes"` BytesDone int64 `json:"bytes_done"` CurrentFiles []string `json:"current_files"` }
func (*BackupProgressEntry) Validate ¶
func (b *BackupProgressEntry) Validate() error
type ErrorWithOutput ¶ added in v1.1.0
func (*ErrorWithOutput) Error ¶ added in v1.1.0
func (e *ErrorWithOutput) Error() string
func (*ErrorWithOutput) Is ¶ added in v1.1.0
func (e *ErrorWithOutput) Is(target error) bool
func (*ErrorWithOutput) Unwrap ¶ added in v1.1.0
func (e *ErrorWithOutput) Unwrap() 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 WithPrefixCommand ¶ added in v1.1.0
func WithPrefixCommand(args ...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, uri string, opts ...GenericOption) *Repo
NewRepo instantiates a new repository.
func (*Repo) AddTags ¶ added in v1.0.0
func (r *Repo) AddTags(ctx context.Context, snapshotIDs []string, tags []string, opts ...GenericOption) error
AddTags adds tags to the specified snapshots.
func (*Repo) Backup ¶
func (r *Repo) Backup(ctx context.Context, paths []string, progressCallback func(*BackupProgressEntry), opts ...GenericOption) (*BackupProgressEntry, error)
func (*Repo) Exists ¶ added in v1.1.0
func (r *Repo) Exists(ctx context.Context, opts ...GenericOption) error
Exists checks if the repository exists. Returns true if exists, false if it does not exist OR an access error occurred.
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) GenericCommand ¶ added in v1.0.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 float64 `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"` SnapshotSummary SnapshotSummary `json:"summary"` // contains filtered or unexported fields }
func (*Snapshot) UnixTimeMs ¶
type SnapshotSummary ¶ added in v1.4.0
type SnapshotSummary struct { BackupStart string `json:"backup_start"` BackupEnd string `json:"backup_end"` FilesNew int64 `json:"files_new"` FilesChanged int64 `json:"files_changed"` FilesUnmodified int64 `json:"files_unmodified"` DirsNew int64 `json:"dirs_new"` DirsChanged int64 `json:"dirs_changed"` DirsUnmodified int64 `json:"dirs_unmodified"` DataBlobs int64 `json:"data_blobs"` TreeBlobs int64 `json:"tree_blobs"` DataAdded int64 `json:"data_added"` DataAddedPacked int64 `json:"data_added_packed"` TotalFilesProcessed int64 `json:"total_files_processed"` TotalBytesProcessed int64 `json:"total_bytes_processed"` // contains filtered or unexported fields }
func (*SnapshotSummary) DurationMs ¶ added in v1.4.0
func (s *SnapshotSummary) DurationMs() int64
Duration returns the duration of the snapshot in milliseconds.
Click to show internal directories.
Click to hide internal directories.