internal

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: May 1, 2020 License: BSD-2-Clause-Views Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Contains added in v0.1.1

func Contains(slice []string, element string) bool

Types

type Backup

type Backup struct {
	Name             string            `json:"name,omitempty"`
	Repositories     []string          `json:"repositories,omitempty"`
	Data             []string          `json:"data,omitempty"`
	DataStdinCommand string            `json:"data_stdin_command,omitempty"`
	StdinFilename    string            `json:"stdin_filename,omitempty"`
	Exclude          []string          `json:"exclude,omitempty"`
	OneFileSystem    bool              `json:"one_file_system,omitempty"`
	Tags             []string          `json:"tags,omitempty"`
	Environment      map[string]string `json:"environment,omitempty"`
	CustomFlags      []string          `json:"custom_flags,omitempty"`
	// contains filtered or unexported fields
}

type BackupAge

type BackupAge struct {
	Warn  jsonutil.Duration `json:"warn,omitempty"`
	Error jsonutil.Duration `json:"error,omitempty"`
}

type BackupHandler

type BackupHandler struct {
	Before   string `json:"before,omitempty"`
	After    string `json:"after,omitempty"`
	Success  string `json:"success,omitempty"`
	Failure  string `json:"failure,omitempty"`
	AgeWarn  string `json:"age_warn,omitempty"`
	AgeError string `json:"age_error,omitempty"`
}

type Check

type Check struct {
	ReadDataPercentage uint `json:"read_data_percentage,omitempty"`
}

type Config

type Config struct {
	ResticExecutable string       `json:"restic_executable,omitempty"`
	Defaults         Defaults     `json:"defaults,omitempty"`
	Repositories     []Repository `json:"repositories,omitempty"`
	Backups          []Backup     `json:"backups,omitempty"`
}

func Load

func Load(configFile string) (Config, error)

func LoadFromReader

func LoadFromReader(reader io.Reader) (Config, error)

func (*Config) GetBackupByName

func (c *Config) GetBackupByName(name string) *Backup

func (*Config) GetRepositoryByName

func (c *Config) GetRepositoryByName(name string) *Repository

type Defaults

type Defaults struct {
	Repositories repositoryDefaultable `json:"repositories,omitempty"`
	Backups      backupDefaultable     `json:"backups,omitempty"`
}

type Policy

type Policy struct {
	KeepLast    uint     `json:"keep_last,omitempty"`
	KeepHourly  uint     `json:"keep_hourly,omitempty"`
	KeepDaily   uint     `json:"keep_daily,omitempty"`
	KeepWeekly  uint     `json:"keep_weekly,omitempty"`
	KeepMonthly uint     `json:"keep_monthly,omitempty"`
	KeepYearly  uint     `json:"keep_yearly,omitempty"`
	KeepWithin  string   `json:"keep_within,omitempty"`
	KeepTags    []string `json:"keep_tags,omitempty"`
}

type Repository

type Repository struct {
	Name        string            `json:"name,omitempty"`
	URL         string            `json:"url,omitempty"`
	Password    string            `json:"password,omitempty"`
	Environment map[string]string `json:"environment,omitempty"`
	Check       Check             `json:"check,omitempty"`
	CustomFlags []string          `json:"custom_flags,omitempty"`
	// contains filtered or unexported fields
}

type RepositoryHandler

type RepositoryHandler struct {
	ForgetSuccess string `json:"forget_success,omitempty"`
	ForgetFailure string `json:"forget_failure,omitempty"`
	CheckSuccess  string `json:"check_success,omitempty"`
	CheckFailure  string `json:"check_failure,omitempty"`
}

type Restic

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

func NewRestic

func NewRestic(resticExecutable string) Restic

func (Restic) CheckAge

func (r Restic) CheckAge(backup Backup, repository Repository) (bool, bool, error)

func (Restic) GetLastBackupTimestamp

func (r Restic) GetLastBackupTimestamp(backup Backup, repository Repository) (time.Time, error)

func (Restic) Init

func (r Restic) Init(repository Repository) error

func (Restic) IsRepositoryAvailable

func (r Restic) IsRepositoryAvailable(repository Repository) error

func (Restic) IsResticAvailable

func (r Restic) IsResticAvailable() bool

func (Restic) Mount

func (r Restic) Mount(repository Repository, mountPoint string) error

func (Restic) PrepareResticEnvironmentCommand

func (r Restic) PrepareResticEnvironmentCommand(
	command string, repoURL string, password string, environment map[string]string,
	limitDownload int, limitUpload int, customFlags []string,
) *exec.Cmd

func (Restic) PrintSnapshots

func (r Restic) PrintSnapshots(repository Repository) error

func (Restic) RunBackup

func (r Restic) RunBackup(backup Backup, repository Repository) error

func (Restic) RunCheck

func (r Restic) RunCheck(repository Repository) error

func (Restic) RunForget

func (r Restic) RunForget(repository Repository) error

type ValidationError

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

func (ValidationError) Error

func (e ValidationError) Error() string

Jump to

Keyboard shortcuts

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