Documentation ¶
Index ¶
Constants ¶
const DefaultRoot = "/etc/zackup"
DefaultRoot is the fallback directory.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type JobConfig ¶
type JobConfig struct { SSH *SSHConfig `yaml:"ssh"` RSync *RsyncConfig `yaml:"rsync"` PreScript Script `yaml:"pre_script"` // from yaml file PostScript Script `yaml:"post_script"` // from yaml file // contains filtered or unexported fields }
JobConfig holds config settings for a single backup job.
type RsyncConfig ¶
type RsyncConfig struct { Included []string `yaml:"include"` Excluded []string `yaml:"exclude"` Arguments []string `yaml:"args"` // OverrideGlobalInclude (and other OverrideGlobal* fields) inhibits // the inheritance of global Included values (or other fields) when // set to true. OverrideGlobalInclude bool `yaml:"override_global_include"` OverrideGlobalExclude bool `yaml:"override_global_exclude"` // see OverrideGlobalInclude OverrideGlobalArguments bool `yaml:"override_global_args"` // see OverrideGlobalInclude }
RsyncConfig holds config value for the rsync binary.
func (*RsyncConfig) BuildArgVector ¶
func (r *RsyncConfig) BuildArgVector(ssh, src, dst string) []string
BuildArgVector creates an ARGV for rsync.
type SSHConfig ¶
type SSHConfig struct { User string `yaml:"user"` // defaults to "root" Port uint16 `yaml:"port"` // defaults to 22 Timeout *uint `yaml:"timeout"` // number of seconds, defaults to 15 }
SSHConfig holds connection parameters.
type Script ¶
type Script struct {
// contains filtered or unexported fields
}
Script is a set of script lines.
func (*Script) UnmarshalYAML ¶
UnmarshalYAML implements the yaml.Unmarshaler interface.
type ServiceConfig ¶
type ServiceConfig struct { Parallel uint8 `yaml:"parallel"` RootDataset string `yaml:"root_dataset"` MountBase string `yaml:"mount_base"` LogLevel string `yaml:"log_level"` RSyncPath string `yaml:"rsync_bin"` SSHPath string `yaml:"ssh_bin"` Daemon struct { Schedule schedule `yaml:"schedule"` Jitter duration `yaml:"jitter"` } `yaml:"daemon"` }
ServiceConfig represents application-level config options.
func (*ServiceConfig) NextSchedule ¶
func (s *ServiceConfig) NextSchedule(ref time.Time) time.Time
NextSchedule returns the next schedule time. It applies the configured jitter, so the result is not be stable (i.e. neither is it monotonically decreasing for increasing reference times, nor returns it the same duration for the same ref).
type Tree ¶
type Tree interface { // SetRoot updates the root config directory. If the given path // is different than the previously setup path, the config tree is // reloaded. SetRoot(newRoot string) error // Root returns the path to the root config directory. Might be empty. Root() string // GetHosts returns the list of configured hosts. Hosts() []string // GetHost returns a copy of the job description for a single host. // If the host is unknown, this returns nil. Host(name string) *JobConfig // Service returns a copy of the current service configuration. Service() *ServiceConfig }
Tree is the internal representation of the configuration directory passed in as ROOT_DIR flag/env var.