Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateDirectoryIfNotExists ¶
CreateDirectoryIfNotExists Checks for a directory string and creates the directory if it does not exist, must be a absolute path.
func Init ¶
func Init(cfg Configuration, db Database)
Init initializes backive with the two basic data structures required, the config, and the database
Types ¶
type Backup ¶
type Backup struct { Name string `mapstructure:",omitempty"` TargetDevice string `mapstructure:"targetDevice"` TargetPath string `mapstructure:"targetPath"` SourcePath string `mapstructure:"sourcePath"` ScriptPath interface{} `mapstructure:"scriptPath"` Frequency int `mapstructure:"frequency"` ExeUser string `mapstructure:"user,omitempty"` Label string `mapstructure:"label,omitempty"` // contains filtered or unexported fields }
Backup contains all necessary information for executing a configured backup.
func (*Backup) CanRun ¶
CanRun Checks the configuration items required and checks the frequency setting with the run database if a Backup should run.
func (*Backup) PrepareRun ¶
PrepareRun prepares a run for a backup, creates a logger for the execution of the backup script and gives the rights of the directory recursively to the user specified.
type Configuration ¶
type Configuration struct { Settings Settings `mapstructure:"settings"` Devices Devices `mapstructure:"devices"` Backups Backups `mapstructure:"backups"` Vconfig *viper.Viper }
Configuration struct holding the settings and config items of devices and backups
func (*Configuration) CreateViper ¶
func (c *Configuration) CreateViper()
CreateViper creates a viper instance for usage later
func (*Configuration) Load ¶
func (c *Configuration) Load()
Load loads the configuration from the disk
type Database ¶
type Database struct {
// contains filtered or unexported fields
}
Database is a simple string to string mapping, where arbitrary strings can be stored and safed to disk or loaded
type Device ¶
type Device struct { Name string `mapstructure:",omitempty"` UUID string `mapstructure:"uuid"` OwnerUser string `mapstructure:"owner,omitempty"` // contains filtered or unexported fields }
Device represents a device, with a name easy to remember and the UUID to identify it, optionally an owner.
type EventHandler ¶
type EventHandler struct {
// contains filtered or unexported fields
}
EventHandler holds the necessary elements to get an eventhandler setup and working.
func (*EventHandler) Init ¶
func (eh *EventHandler) Init(socketPath string) error
Init initializes the unix socket.
func (*EventHandler) RegisterCallback ¶
func (eh *EventHandler) RegisterCallback(cb func(map[string]string))
RegisterCallback adds a function to the list of callback functions for processing of events.
type Runs ¶
type Runs struct {
// contains filtered or unexported fields
}
Runs contains the Data for the scheduler: mapping from backups to a list of timestamps of the last 10 backups
func (*Runs) RegisterRun ¶
RegisterRun saves a date of a backup run into the internal storage
type Settings ¶
type Settings struct { SystemMountPoint string `mapstructure:"systemMountPoint"` UserMountPoint string `mapstructure:"userMountPoint"` UnixSocketLocation string `mapstructure:"unixSocketLocation"` LogLocation string `mapstructure:"logLocation"` DbLocation string `mapstructure:"dbLocation"` }
Settings struct holds the global configuration items