snapper

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Nov 21, 2024 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Periodic

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

func (*Periodic) Periodic added in v0.8.10

func (s *Periodic) Periodic() bool

func (*Periodic) Report

func (s *Periodic) Report() Report

func (*Periodic) Run

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

func (*Periodic) Running

func (s *Periodic) Running() (d time.Duration, ok bool)

func (*Periodic) Shutdown

func (s *Periodic) Shutdown()

type PeriodicReport

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

func (*PeriodicReport) CompletionProgress

func (self *PeriodicReport) CompletionProgress() (expected, completed uint64)

func (*PeriodicReport) IsTerminal

func (self *PeriodicReport) IsTerminal() bool

func (*PeriodicReport) Running

func (self *PeriodicReport) Running() (d time.Duration, ok bool)

func (*PeriodicReport) SortProgress

func (self *PeriodicReport) SortProgress() []*ReportFilesystem

type Report

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

func (*Report) Cron

func (self *Report) Cron() string

func (*Report) Error

func (self *Report) Error() string

func (*Report) Progress

func (self *Report) Progress() (uint64, uint64)

func (*Report) Running

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

func (*Report) SleepingUntil

func (self *Report) SleepingUntil() time.Time

type ReportFilesystem

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 {
	Periodic() bool
	Run(ctx context.Context, snapshotsTaken chan<- struct{}, cron *cron.Cron)
	Report() Report
	Shutdown()
	Running() (time.Duration, bool)
}

type State

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

func (State) IsTerminal

func (s State) IsTerminal() bool

func (State) String

func (i State) String() string

type Type

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