pruner

package
v0.7.9 Latest Latest
Warning

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

Go to latest
Published: Jun 20, 2024 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NotSkipped                   = ""
	SkipPlaceholder              = "filesystem is placeholder"
	SkipNoCorrespondenceOnSender = "filesystem has no correspondence on sender"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type FSReport

type FSReport struct {
	Filesystem                string
	SnapshotList, DestroyList []SnapshotReport
	SkipReason                FSSkipReason
	LastError                 string
}

type FSSkipReason

type FSSkipReason string

func (FSSkipReason) NotSkipped

func (r FSSkipReason) NotSkipped() bool

type LocalPrunerFactory

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

func NewLocalPrunerFactory

func NewLocalPrunerFactory(in config.PruningLocal, promPruneSecs *prometheus.HistogramVec) (*LocalPrunerFactory, error)

func (*LocalPrunerFactory) BuildLocalPruner

func (f *LocalPrunerFactory) BuildLocalPruner(ctx context.Context, target Target, history Sender) *Pruner

type Logger

type Logger = logger.Logger

func GetLogger

func GetLogger(ctx context.Context) Logger

type Pruner

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

func (*Pruner) Prune

func (p *Pruner) Prune()

func (*Pruner) Report

func (p *Pruner) Report() *Report

func (*Pruner) State

func (p *Pruner) State() State

type PrunerFactory

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

func NewPrunerFactory

func NewPrunerFactory(in config.PruningSenderReceiver, promPruneSecs *prometheus.HistogramVec) (*PrunerFactory, error)

func (*PrunerFactory) BuildReceiverPruner

func (f *PrunerFactory) BuildReceiverPruner(ctx context.Context, target Target, sender Sender) *Pruner

func (*PrunerFactory) BuildSenderPruner

func (f *PrunerFactory) BuildSenderPruner(ctx context.Context, target Target, sender Sender) *Pruner

type Report

type Report struct {
	State              string
	Error              string
	Pending, Completed []FSReport
}

type Sender added in v0.7.4

type Sender interface {
	ReplicationCursor(ctx context.Context, req *pdu.ReplicationCursorReq) (*pdu.ReplicationCursorRes, error)
	ListFilesystems(ctx context.Context, req *pdu.ListFilesystemReq) (*pdu.ListFilesystemRes, error)
}

The sender in the replication setup. The pruner uses the Sender to determine which of the Target's filesystems need to be pruned. Also, it asks the Sender about the replication cursor of each filesystem to enable the 'not_replicated' pruning rule.

Try to keep it compatible with github.com/dsh2dsh/zrepl/endpoint.Endpoint

type SnapshotReport

type SnapshotReport struct {
	Name       string
	Replicated bool
	Date       time.Time
}

type State

type State int
const (
	Plan State = 1 << iota
	PlanErr
	Exec
	ExecErr
	Done
)

func StateString

func StateString(s string) (State, error)

StateString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func StateValues

func StateValues() []State

StateValues returns all values of the enum

func (State) IsAState

func (i State) IsAState() bool

IsAState returns "true" if the value is listed in the enum definition. "false" otherwise

func (State) IsTerminal added in v0.7.4

func (s State) IsTerminal() bool

Returns true in case the State is a terminal state(PlanErr, ExecErr, Done)

func (State) String

func (i State) String() string

type Target

type Target interface {
	ListFilesystems(ctx context.Context, req *pdu.ListFilesystemReq) (*pdu.ListFilesystemRes, error)
	ListFilesystemVersions(ctx context.Context, req *pdu.ListFilesystemVersionsReq) (*pdu.ListFilesystemVersionsRes, error)
	DestroySnapshots(ctx context.Context, req *pdu.DestroySnapshotsReq) (*pdu.DestroySnapshotsRes, error)
}

The pruning target, i.e., on which snapshots are destroyed. This can be a replication sender or receiver.

Try to keep it compatible with github.com/dsh2dsh/zrepl/endpoint.Endpoint

Jump to

Keyboard shortcuts

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