snapper

package
v0.7.11 Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2024 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Logger

type Logger = logger.Logger

type Periodic added in v0.7.4

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

func (*Periodic) Report added in v0.7.4

func (s *Periodic) Report() Report

func (*Periodic) Run added in v0.7.4

func (s *Periodic) Run(ctx context.Context, snapshotsTaken chan<- struct{},
	cron *cron.Cron,
)

func (*Periodic) RunPeriodic added in v0.7.6

func (s *Periodic) RunPeriodic() bool

func (*Periodic) Shutdown added in v0.7.10

func (s *Periodic) Shutdown()

type PeriodicReport added in v0.7.4

type PeriodicReport struct {
	CronSpec string
	State    State
	// valid in state SyncUp and Waiting
	SleepUntil time.Time
	// valid in state Err
	Error string
	// valid in state Snapshotting
	Progress []*ReportFilesystem
}

func (*PeriodicReport) Running added in v0.7.4

func (self *PeriodicReport) Running() time.Duration

type Report added in v0.7.4

type Report struct {
	Type     Type
	Periodic *PeriodicReport
	Manual   *struct{}
}

func (*Report) Error added in v0.7.4

func (self *Report) Error() string

func (*Report) Running added in v0.7.4

func (self *Report) Running() time.Duration

type ReportFilesystem added in v0.7.4

type ReportFilesystem struct {
	Path  string
	State SnapState

	// Valid in SnapStarted and later
	SnapName      string
	StartAt       time.Time
	Hooks         string
	HooksHadError bool

	// Valid in SnapDone | SnapError
	DoneAt time.Time
}

type SnapState

type SnapState uint
const (
	SnapPending SnapState = 1 << iota
	SnapStarted
	SnapDone
	SnapError
)

func (SnapState) String

func (i SnapState) String() string

type Snapper

type Snapper interface {
	RunPeriodic() bool
	Run(ctx context.Context, snapshotsTaken chan<- struct{}, cron *cron.Cron)
	Report() Report
	Shutdown()
}

type State

type State uint
const (
	SyncUp State = 1 << iota
	SyncUpErrWait
	Planning
	Snapshotting
	Waiting
	ErrorWait
	Stopped
)

func (State) String

func (i State) String() string

type Type added in v0.7.4

type Type string
const (
	TypePeriodic Type = "periodic"
	TypeCron     Type = "cron"
	TypeManual   Type = "manual"
)

Jump to

Keyboard shortcuts

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