backup

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2022 License: GPL-3.0 Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupCollection

type BackupCollection struct {
	SourcePath string                 // Path to the source folder
	Backups    map[string]*BackupFile // Map of files and their backups
}

func NewBackupCollection

func NewBackupCollection(sourcePath string, config BackupConfig, files ...string) (bc *BackupCollection, err error)

func (*BackupCollection) AutoBackup

func (bc *BackupCollection) AutoBackup(config BackupConfig) (done bool, err error)

func (*BackupCollection) DoBackup

func (bc *BackupCollection) DoBackup() (err error)

type BackupConfig

type BackupConfig struct {
	BackupNeededWarningDays int    `yaml:"backup_needed_warning_days"`
	BackupMaxCount          int    `yaml:"backup_max_count"`
	AutoBackup              bool   `yaml:"auto_backup"`
	AutoBackupIntervalDays  int    `yaml:"auto_backup_interval_days"`
	BackupFolder            string `yaml:"backup_folder"`
}

func GetDefaultBackupConfig

func GetDefaultBackupConfig(dataFolder string) BackupConfig

func (BackupConfig) String

func (bc BackupConfig) String() string

type BackupFile

type BackupFile struct {
	Source         string
	BackupPath     string
	LastBackups    []string
	LastBackup     string
	LastBackupTime time.Time
}

func CreateBackup

func CreateBackup(source string, backupPath string, config BackupConfig) (bkp *BackupFile, err error)

func (*BackupFile) AutoBackup

func (b *BackupFile) AutoBackup(config BackupConfig) (done bool, err error)

func (*BackupFile) DoBackup

func (b *BackupFile) DoBackup() (backupFile string, err error)

func (*BackupFile) NeedsBackup

func (b *BackupFile) NeedsBackup() bool

func (*BackupFile) PurgeOldBackups

func (b *BackupFile) PurgeOldBackups(config BackupConfig) error

func (*BackupFile) ReadBackups

func (b *BackupFile) ReadBackups() error

Jump to

Keyboard shortcuts

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