snapper

package
v1.2.0 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2026 License: MIT Imports: 23 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewProgress added in v0.9.5

func NewProgress() *progress

Types

type Periodic

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

func (*Periodic) Cron added in v0.9.3

func (self *Periodic) Cron() string

func (*Periodic) Periodic added in v0.8.10

func (self *Periodic) Periodic() bool

func (*Periodic) Report

func (self *Periodic) Report() Report

func (*Periodic) Run

func (self *Periodic) Run(ctx context.Context)

func (*Periodic) Runnable added in v0.9.3

func (self *Periodic) Runnable() bool

func (*Periodic) Running

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

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 (self SnapState) String() string

type Snapper

type Snapper interface {
	Cron() string
	Periodic() bool
	Runnable() bool
	Run(ctx context.Context)
	Report() Report
	Running() (time.Duration, bool)
}

type State

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

func (State) IsTerminal

func (self State) IsTerminal() bool

func (State) Running added in v0.9.3

func (self State) Running() bool

func (State) String

func (self 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