bkp

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const BackupEnabled = "ch.floor4:backup_enabled"

BackupEnabled zfs attribute. True means filesystem should be backed up

View Source
const IncrementalInterval = "ch.floor4:incremental_interval"

IncrementalInterval zfs attribute. Specifies the time in seconds between two incremental backups

Variables

This section is empty.

Functions

This section is empty.

Types

type Backup

type Backup interface {
	// It can't be started again after calling MarkSuccessful
	MarkSuccessful(archiveID string) error
	GetPartSize() int
	NextPart() (io.ReadSeeker, []byte)
	HasNextPart() bool
	GetBaseDataset() zfsiface.Dataset
	GetDataset() zfsiface.Dataset
	IsIncremental() bool
	GetDescription() string
}

A Backup is a backup process that when started writes the backup to a backup location

type Batch

type Batch struct {
	// contains filtered or unexported fields
}

A Batch contains zfs filesystems that can be stored in aws glacier when executed

func NewBatch

func NewBatch(filter string) (*Batch, error)

NewBatch creates a new batch If filter is set, only filesystems under the given path are considered.

func (*Batch) Init

func (b *Batch) Init() error

Init prepares the Batch for execution with Run It searches for ZFS filesystems which are tagged for backup and whose next backup is due. Initialize aws client It also checks which vaults already exist on aws glacier

func (*Batch) Print

func (b *Batch) Print()

Print renders a table to stdout which displays backup status

func (*Batch) Run

func (b *Batch) Run() error

Run does the acutual backup on aws glacier 1. create a snapshot of each ZFSFilesystem to backup 2. create vaults for volumes without an existing vault 3. create diff to previous snapshot 4. upload one snapshot after the other

type Filesystem

type Filesystem interface {
	// IsBackupEnabled returns true if the backup it should be backed up on a regular basis
	IsBackupEnabled() bool
	// GetVaultName transforms the filesystem name into a valid aws vault name
	// It replaces all non -a-zA-Z0-9 characters with underscores
	GetVaultName() string
	// IsDue returns true if it is time for a next backup
	IsDue() bool
	// Backup returns a Backup which can be started. It will then write the backup to the given writer.
	// Depending on the backup history it decides if a full or an incremental backup should be done.
	Backup(forceFull bool) Backup
}

A Filesystem provides all information to decide if a backup should be done

func ListZFSFilesystems

func ListZFSFilesystems(filter string) ([]Filesystem, error)

ListZFSFilesystems returns a list of all zfs filesystems under the path given by filter

type Metadata

type Metadata struct {
	BaseArchiveID string `json:",omitempty"`
	IsIncremental bool
}

Metadata contains information for a backup that is rendered as JSON It is saved as description field in aws

type ZFSFilesystem

type ZFSFilesystem struct {
	// contains filtered or unexported fields
}

ZFSFilesystem extends the go-zfs ZFSFilesystem with properties needed for

func (*ZFSFilesystem) Backup

func (fs *ZFSFilesystem) Backup(forceFull bool) Backup

Backup returns a Backup which can be started. It will then write the backup to the given writer. Depending on the backup history it decides if a full or an incremental backup should be done.

func (*ZFSFilesystem) GetVaultName

func (fs *ZFSFilesystem) GetVaultName() string

GetVaultName transforms the filesystem name into a valid aws vault name It replaces all non -a-zA-Z0-9 characters with underscores

func (*ZFSFilesystem) IsBackupEnabled

func (fs *ZFSFilesystem) IsBackupEnabled() bool

IsBackupEnabled returns true if the backup it should be backed up on a regular basis

func (*ZFSFilesystem) IsDue

func (fs *ZFSFilesystem) IsDue() bool

IsDue returns true if it is time for a next backup

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL