internal

package
v0.1.0-alpha.5 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2022 License: BSD-3-Clause Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const DirectoryStanzaType = "directory"
View Source
const ZFSDatasetStanzaType = "zfs-dataset"
View Source
const ZFSZvolStanzaType = "zfs-zvol"

Variables

View Source
var (
	LogDebug  = log.New(os.Stdout, "DEBUG:  ", 0)
	LogInfo   = log.New(os.Stdout, "INFO:   ", 0)
	LogWarn   = log.New(os.Stdout, "WARN:   ", 0)
	LogError  = log.New(os.Stdout, "ERROR:  ", log.Lshortfile)
	LogRestic = log.New(os.Stdout, "RESTIC: ", 0)
)

Functions

func ExecCommand

func ExecCommand(name string, args ...string) (string, int, error)

func ExecCommandRetry

func ExecCommandRetry(name string, args ...string) (string, int, error)

func ExecCommandRetryWithOpts

func ExecCommandRetryWithOpts(opts ExecCommandOpts) (string, int, error)

func ExecCommandWithOpts

func ExecCommandWithOpts(opts ExecCommandOpts) (string, int, error)

func GenerateRandomString

func GenerateRandomString(n int) string

Types

type Config

type Config struct {
	Stanzas   []ConfigStanza  `yaml:"stanzas"`
	Restic    ConfigRestic    `yaml:"restic"`
	SFTP      ConfigSFTP      `yaml:"sftp"`
	Cron      ConfigCron      `yaml:"cron"`
	Bandwidth ConfigBandwidth `yaml:"bandwidth"`
}

type ConfigBandwidth

type ConfigBandwidth struct {
	Download int `yaml:"download"`
	Upload   int `yaml:"upload"`
}

type ConfigCron

type ConfigCron struct {
	Cleanup ConfigCronCleanup `yaml:"cleanup"`
}

type ConfigCronCleanup

type ConfigCronCleanup struct {
	Enabled bool                  `yaml:"enabled"`
	Keep    ConfigCronCleanupKeep `yaml:"keep"`
}

type ConfigCronCleanupKeep

type ConfigCronCleanupKeep struct {
	Last    int `yaml:"last"`
	Daily   int `yaml:"daily"`
	Weekly  int `yaml:"weekly"`
	Monthly int `yaml:"monthly"`
	Yearly  int `yaml:"yearly"`
}

type ConfigRestic

type ConfigRestic struct {
	Password string `yaml:"password"`
}

type ConfigSFTP

type ConfigSFTP struct {
	Host               string `yaml:"host"`
	Port               int    `yaml:"port"`
	User               string `yaml:"user"`
	IdentityPrivateKey string `yaml:"identityPrivateKey"`
}

type ConfigStanza

type ConfigStanza struct {
	Type           string `yaml:"type"`
	Implementation Stanza
}

func (*ConfigStanza) UnmarshalYAML

func (ct *ConfigStanza) UnmarshalYAML(value *yaml.Node) error

type Context

type Context struct {
	ResticVersion    string
	ResticBinary     string
	SFTPIdentityFile string
	Config           Config
}

func NewContext

func NewContext(file string) (*Context, error)

func (*Context) ExecRestic

func (c *Context) ExecRestic(args ...string) error

type DirectoryStanza

type DirectoryStanza struct {
	From string `yaml:"from"`
}

func (*DirectoryStanza) Post

func (t *DirectoryStanza) Post()

func (*DirectoryStanza) Pre

func (t *DirectoryStanza) Pre() ([]string, error)

func (*DirectoryStanza) String

func (t *DirectoryStanza) String() string

type ExecCommandOpts

type ExecCommandOpts struct {
	Name   string
	Args   []string
	Env    []string
	Logger *log.Logger
}

type LogWriter

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

func NewLogWriter

func NewLogWriter(logger *log.Logger) *LogWriter

func (*LogWriter) Write

func (l *LogWriter) Write(p []byte) (n int, err error)

type Stanza

type Stanza interface {
	Pre() ([]string, error)
	Post()
	String() string
}

type ZFSDatasetStanza

type ZFSDatasetStanza struct {
	From string `yaml:"from"`
	// contains filtered or unexported fields
}

func (*ZFSDatasetStanza) Post

func (t *ZFSDatasetStanza) Post()

func (*ZFSDatasetStanza) Pre

func (t *ZFSDatasetStanza) Pre() ([]string, error)

func (*ZFSDatasetStanza) String

func (t *ZFSDatasetStanza) String() string

type ZFSZvolStanza

type ZFSZvolStanza struct {
	From string `yaml:"from"`
	// contains filtered or unexported fields
}

func (*ZFSZvolStanza) Post

func (t *ZFSZvolStanza) Post()

func (*ZFSZvolStanza) Pre

func (t *ZFSZvolStanza) Pre() ([]string, error)

func (*ZFSZvolStanza) String

func (t *ZFSZvolStanza) String() string

Jump to

Keyboard shortcuts

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