qsbackup

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2018 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsExists

func IsExists(filename string) (bool, error)

IsExists checks if specified file exists.

Types

type Archiver

type Archiver interface {
	Archive(src, dest string, logger *logger.Log) (string, error)
}

Archiver represents type capable of archiving

var ZIP Archiver = (*zipper)(nil)

ZIP is an Archiver that zips files.

type AwsStorage

type AwsStorage struct {
	Archiver     Archiver
	AccessKeyID  string
	AccessSecret string
	Region       string
	Bucket       string
}

AwsStorage represents the AWS storage

func (*AwsStorage) Save

func (storage *AwsStorage) Save(src string, logger *logger.Log) error

Save backups a dir and saves it in the S3

type Backup

type Backup struct {
	Logger     *logger.Log
	BackupDirs []string
	Storage    Storage
}

Backup archives dirs and save them in a storage

func New

func New(Config *BackupConfig, Logger *logger.Log) (*Backup, error)

New creates a new Backup.

func (*Backup) Run

func (b *Backup) Run() error

Run is runner

type BackupConfig

type BackupConfig struct {
	Name        string
	Description string `yaml:"description,omitempty"`
	Logfile     string `yaml:"logfile,omitempty"`
	Storage     BackupStorage
	Dirs        []Dir `yaml:"dirs,omitempty"`
}

BackupConfig represents types capable of read a config file

func ConfigLoad

func ConfigLoad(input []byte) (*BackupConfig, error)

ConfigLoad will unmarshal and validate a config data

type BackupStorage

type BackupStorage struct {
	Type      string
	DestPath  string `yaml:"dest_path,omitempty"`
	AwsRegion string `yaml:"aws_region,omitempty"`
	AwsBucket string `yaml:"aws_bucket,omitempty"`
	AwsKey    string `yaml:"aws_key,omitempty"`
	AwsSecret string `yaml:"aws_secret,omitempty"`
}

BackupStorage represents types capable of represent a backup storage

type Dir

type Dir struct {
	Name        string
	Description string `yaml:"description,omitempty"`
	Path        string
}

Dir represents types capable of read a backup directory path

type LocalStorage

type LocalStorage struct {
	Archiver Archiver
	DestPath string
}

LocalStorage represents the local storage

func (*LocalStorage) Save

func (storage *LocalStorage) Save(src string, logger *logger.Log) error

Save backups a dir and saves it in the dest path

type Storage

type Storage interface {
	Save(src string, logger *logger.Log) error
}

Storage represents type capable to save an archive

Directories

Path Synopsis
cmd
pkg
logger
Usage
Usage

Jump to

Keyboard shortcuts

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