Documentation
¶
Index ¶
- Variables
- type Backup
- type BackupType
- type Backups
- func (bs Backups) Expired(id ulid.ULID, expiry *config.Expiry) (bool, error)
- func (bs Backups) ExpiredBackupsForDataset(dataset string, expiry *config.Expiry) (Backups, error)
- func (bs Backups) GetAllChildren(id ulid.ULID) Backups
- func (bs Backups) GetChildren(id ulid.ULID) Backups
- func (bs Backups) GetParent(dataset string, typ BackupType) (*Backup, error)
- func (bs Backups) LatestDiff(dataset string) *Backup
- func (bs Backups) LatestFull(dataset string) *Backup
- func (bs Backups) LatestIncr(dataset string) *Backup
- func (bs Backups) RemoveBackup(id ulid.ULID) error
- func (bs Backups) TimeTillExpiry(id ulid.ULID, expiry *config.Expiry) (time.Duration, error)
- func (bs Backups) Validate(id ulid.ULID) error
- type Orphan
- type OrphanReason
- type Orphans
- type Store
- func (s *Store) AddBackup(ctx context.Context, backup Backup) error
- func (s *Store) AddOrphan(ctx context.Context, backup Backup, reason OrphanReason) error
- func (s *Store) RemoveOrphan(ctx context.Context, backup Backup) error
- func (s *Store) Save(ctx context.Context, storage storage.StrongStore) error
- func (s *Store) Validate() error
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrBackupCreatedInFuture = errors.New("backup created in the future") ErrFullBackupHasParent = errors.New("full backup depends on a parent backup") ErrDiffBackupNoParent = errors.New("diff backup does not depend on a parent backup") ErrDiffBackupParentNotFull = errors.New("diff backup depends on a parent backup that is not a full backup") ErrIncrBackupNoParent = errors.New("incremental backup does not depend on a parent backup") ErrIncrBackupParentNotDiff = errors.New("incremental backup depends on a parent backup that is not a diff backup") ErrUnknownBackupType = errors.New("unknown backup type") ErrBackupIDMismatch = errors.New("backup ID mismatch") ErrParentBackupNotFound = errors.New("parent backup not found") )
Error variables for backup validation
Functions ¶
This section is empty.
Types ¶
type BackupType ¶
type BackupType string
const ( BackupTypeFull BackupType = "full" BackupTypeDiff BackupType = "diff" BackupTypeIncr BackupType = "incr" )
type Backups ¶
func (Backups) Expired ¶
Expired returns true if the backup is expired. Backups expire when their time is lapsed, or when their parent is expired.
func (Backups) ExpiredBackupsForDataset ¶
func (Backups) GetParent ¶
func (bs Backups) GetParent(dataset string, typ BackupType) (*Backup, error)
func (Backups) LatestDiff ¶
LatestDiff returns the latest diff backup.
func (Backups) LatestFull ¶
LatestFull returns the latest full backup.
func (Backups) LatestIncr ¶
LatestIncr returns the latest incremental backup.
func (Backups) TimeTillExpiry ¶
type Orphan ¶
type Orphan struct {
Backup Backup `json:"backup"`
Reason OrphanReason `json:"reason"`
}
func (*Orphan) SafeToDelete ¶
type OrphanReason ¶
type OrphanReason string
const ( OrphanReasonUncommitted OrphanReason = "uncommitted" OrphanReasonStartedDeletion OrphanReason = "started_deletion" )
type Store ¶
type Store struct {
Version int `json:"version"`
CreatedAt time.Time `json:"created_at"`
Backups Backups `json:"backups"`
Orphans Orphans `json:"orphans"`
Encryption config.Encryption `json:"encryption"`
ManagedDatasets []string `json:"managed_datasets"`
Hash *string `json:"hash"`
}
Store is the main struct that contains the backups and orphans. It is made to be stored in a single file, usually on the same filesystem as the zfsbackrest repository.
Click to show internal directories.
Click to hide internal directories.