backups

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BackupperArgs

type BackupperArgs struct {
	SkipNotMofiedFor time.Duration
}

type FileTransfer

type FileTransfer struct {
	Remote string
	Local  string
}

func (FileTransfer) String

func (ft FileTransfer) String() string

type FileType

type FileType int
const (
	IsFile FileType = iota
	IsDir
	NotExist
)

type RestorerArgs

type RestorerArgs struct {
	Force bool
}

type S3Args

type S3Args struct {
	AccessKeyID     string
	SecretAccessKey string
	EndPoint        string
	Bucket          string
	Region          string
}

type S3Transferrer

type S3Transferrer struct {
	*RestorerArgs
	*BackupperArgs

	ctxerr.CtxErrCanceler
	// contains filtered or unexported fields
}

S3Transferrer is a Transferrer that backups and restores files to and from S3 compatible storage

func NewS3Transferrer

func NewS3Transferrer(s3Args S3Args, concurrentTransfers int, f context.CancelFunc, rateLimitingArgs retries.RateLimiterArgs, restorerArgs *RestorerArgs, backuperArgs *BackupperArgs) *S3Transferrer

func (*S3Transferrer) Backup

func (t *S3Transferrer) Backup(ctx context.Context, ft FileTransfer)

Backup backups one or more files to S3

  • If ft.Local ends with a '/', it is considered a directory and all files in that directory will be restored.
  • If ft.Local ends with a '*', it is considered a directory and all files in that directory will be restored recursively.
  • If ft.Local does not end with any of '/' and '*', it will be considered a file.

func (*S3Transferrer) Restore

func (t *S3Transferrer) Restore(ctx context.Context, ft FileTransfer)

Restore restores one or more files from S3

  • If ft.Remote ends with a '/', it is considered a directory and all files in that directory will be restored. In this case, ft.Local must be a directory as well.
  • If ft.Remote ends with a '/*', it is considered a prefix and all files with that prefix will be restored. In this case, ft.Local must be a directory as well.
  • If ft.Remote does not end with any of '/' and '/*', it will be considered as a file and will be restored In this case, ft.Local must be a file as well.

func (*S3Transferrer) Wait

func (t *S3Transferrer) Wait()

type Transferrer

type Transferrer interface {
	Backup(ft FileTransfer) error
	Restore(ft FileTransfer) error
}

Jump to

Keyboard shortcuts

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