backup

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2024 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var CommandMap = map[string]CmdFunc{
	"sleep":  cmdSleep,
	"cd":     cmdCD,
	"export": cmdExport,
}

Functions

This section is empty.

Types

type BackupError

type BackupError struct {
	Code    BackupErrorCode
	Source  string
	Message string
}

func (BackupError) Localize

func (e BackupError) Localize(langs ...string) string

type BackupErrorCode

type BackupErrorCode int8
const (
	GenericError BackupErrorCode = iota
	CmdInvalid
	CmdFailed
	PathError
	UploadError
	DownloadError
)

func (BackupErrorCode) Error

func (e BackupErrorCode) Error(source string, message string) BackupError

func (BackupErrorCode) ID

func (e BackupErrorCode) ID() string

type BackupOptFunc

type BackupOptFunc func(*BackupOpts)

func WithDebug

func WithDebug(debug bool) BackupOptFunc

func WithDownload

func WithDownload() BackupOptFunc

func WithInteractivity

func WithInteractivity(interactive bool) BackupOptFunc

func WithLanguage

func WithLanguage(lang string) BackupOptFunc

func WithRemote

func WithRemote(remote string) BackupOptFunc

func WithRemoteRoot

func WithRemoteRoot(remoteRoot string) BackupOptFunc

func WithSimulation

func WithSimulation(simulate bool) BackupOptFunc

type BackupOpts

type BackupOpts struct {
	Remote     string
	RemoteRoot string
	Language   string
	Uploading  bool
	Simulate   bool
	Unattended bool
	Debug      bool
}

type BackupSession

type BackupSession struct {
	Opts     *BackupOpts
	Machine  *config.Machine
	Notifier *notify.Notifier
	// contains filtered or unexported fields
}

func NewSession

func NewSession(ctx context.Context, options ...BackupOptFunc) *BackupSession

func (*BackupSession) Backup

func (session *BackupSession) Backup()

func (*BackupSession) Heartbeat

func (session *BackupSession) Heartbeat(endpoint string, withLog bool)

func (*BackupSession) NotifyStatus

func (session *BackupSession) NotifyStatus(status string, statusTags ...string)

type CmdFunc

type CmdFunc func(chan BackupError, string) string

type CommandOpts

type CommandOpts struct {
	CWD string
	Env []string
}

Jump to

Keyboard shortcuts

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