app

package
v1.1.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2021 License: GPL-3.0 Imports: 26 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// RootDataset is the name of the ZFS dataset under which zackup
	// creates per-host datasets.
	RootDataset = "zroot"

	// MountBase is the name of the directory which zackup uses to
	// mount per-host datasets for rsync.
	//
	// A special directory (MountBase/.zackup) is used as working
	// directory for temporary files, such as SSH ControlPath sockets.
	MountBase = "/zpool/zackup"

	// RSyncPath might need to be adjusted if it's not in $PATH.
	RSyncPath = "rsync"

	// SSHPath might need to be adjusted if it's not in $PATH.
	SSHPath = "ssh"
)
View Source
var ErrAlreadyConnected = errors.New("ssh: tunnel already established")

Functions

func InitializeState

func InitializeState(tree config.Tree) error

InitializeState reads the performance metrics stored in the data.

func PerformBackup

func PerformBackup(job *config.JobConfig)

PerformBackup executes the backup job.

Types

type HTTP

type HTTP interface {
	// Start will start the HTTP server.
	Start()

	// Stop will graceful shut down the HTTP server.
	Stop()
}

HTTP allows interaction with the zackup webserver.

func NewHTTP

func NewHTTP(listen string) HTTP

NewHTTP sets a new web server up, mainly for metrics, but also for a quick overview.

type HostMetrics

type HostMetrics struct {
	Host string
	// contains filtered or unexported fields
}

HostMetrics represents a snapshot of the current metrics for a host.

func ExportState

func ExportState() []HostMetrics

ExportState dumps the current performance metrics.

func (*HostMetrics) SpaceUsedTotal

func (m *HostMetrics) SpaceUsedTotal() uint64

func (*HostMetrics) Status

func (m *HostMetrics) Status() MetricStatus

type MetricStatus

type MetricStatus int

MetricStatus represents the status of a metric set.

const (
	StatusUnknown MetricStatus = iota
	StatusPrimed
	StatusSuccess
	StatusFailed
	StatusRunning
)

All possible MetricStatus values.

func (MetricStatus) String

func (s MetricStatus) String() string

type Queue

type Queue interface {
	// Enqueue adds a job to the queue. The job is run immediately if the
	// queue is empty. This method may block if a backlog has accumulated.
	Enqueue(job *config.JobConfig)

	// Resize changes the size of the queue. When sizing down, surplus
	// running jobs will finish. Values for newSize are capped; for values
	// less then 1, 1 is assumed, and for values larger than an arbitrary
	// threshold, that threshold value is assumed.
	Resize(newSize int)

	// Wait will wait for all jobs to complete.
	Wait()
}

Queue manages the parallel execution of jobs.

func NewQueue

func NewQueue() Queue

NewQueue constructs an empty queue with the given size and starts the same amount of workers.

type Scheduler

type Scheduler interface {
	// Start begins a new schedule cycle. This method will block until
	// you call Stop().
	Start()

	// Stop halts the scheduler. Running jobs are still finished, though.
	Stop()
}

The Scheduler periodically performs backups.

func NewScheduler

func NewScheduler(queue Queue) Scheduler

NewScheduler returns a new scheduler instance. It reads the schedule interval from the config.Tree and enqueue new backup jobs into queue. The instance is not started yet, you need to call Start().

type State

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

State holds metrics, mainly for Prometheus. Upon start it is restored from a disk cache and regularly written back.

Jump to

Keyboard shortcuts

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