backup

package
v0.75.8 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const EntryTimeFormat = time.RFC3339

Variables

This section is empty.

Functions

func CheckZfsCommand

func CheckZfsCommand() error

func CreateRecursiveZfsSnapshot

func CreateRecursiveZfsSnapshot(pool string, ID string) error

Types

type BackupEntry

type BackupEntry struct {
	ID       string
	Date     string
	Block    string
	Origin   string
	Location string
	Full     bool
	Pools    []Pool
}

type Config

type Config struct {
	Destination S3Config `` /* 366-byte string literal not displayed */

	FullBackup FullBackupConfig `toml:"full_backup"`

	CoreRestURL         string `toml:"core_rest_url" comment:"Core REST URL where the /statistics endpoint is available"`
	PoolName            string `toml:"pool_name" comment:"Pool name to backup, We backup all inherited pools as well"`
	StateFilePath       string `toml:"state_file" comment:"Path where the state is saved"`
	ZfsBackupBinaryPath string `toml:"zfsbackup_binary" comment:"Path for the binary https://github.com/someone1/zfsbackup-go"`
}

func DefaultConfig

func DefaultConfig() Config

func LoadConfig

func LoadConfig(filePath string) (*Config, error)

func (Config) Check

func (conf Config) Check() error

func (Config) Marshal

func (conf Config) Marshal() (string, error)

type FullBackupConfig

type FullBackupConfig struct {
	WhenEmptyState    bool          `toml:"when_empty_state" comment:"Full backup is enforced when there is no prevous backups in the state file"`
	EveryNBackups     int           `toml:"every_n_backups" comment:"Defines how ofter(every N backups) full backup must be created"`
	EveryTimeDuration time.Duration `toml:"every_time_duration" comment:"Define how often(in term of times) full backup must be created"`
}

type Pool

type Pool struct {
	Name       string
	MountPoint string
}

func ListZfsPools

func ListZfsPools(parent string) ([]Pool, error)

type S3Config

type S3Config struct {
	Endpoint               string `toml:"endpoint" comment:"The S3 endpoint"`
	Region                 string `toml:"region" comment:"The S3 region"`
	Bucket                 string `toml:"bucket" comment:"The S3 bucket name where backup is located"`
	Path                   string `toml:"path" comment:"The path on S3 where the backup is located. It is composed with bucket name into s3://<bucket>/<path>"`
	AccessKeyIdEnvName     string `toml:"access_key_id_env_name" comment:"Environment variable name used to source access key id for the S3 API"`
	AccessKeySecretEnvName string `toml:"access_key_secret_env_name" comment:"Environment variable name used to source access key secret for the S3 API"`
}

type State

type State struct {
	Config Config

	Backups []BackupEntry
}

func LoadStateFromFile

func LoadStateFromFile(filePath string) (*State, error)

func OpenOrCreateNewState

func OpenOrCreateNewState(filePath string, config *Config) *State

func (*State) AddEntry

func (state *State) AddEntry(id, location string, blockHeight int, full bool, pools []Pool) error

func (State) Empty

func (state State) Empty() bool

func (State) Save

func (state State) Save(filePath string) error

func (State) SortedBackups

func (state State) SortedBackups() []BackupEntry

Jump to

Keyboard shortcuts

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