job

package
v0.9.10 Latest Latest
Warning

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

Go to latest
Published: May 15, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CreatedSnapshotEvent         eventemitter.EventType = "created-snapshot"
	StartSendingSnapshotEvent    eventemitter.EventType = "start-sending-snapshot"
	SnapshotSendingProgressEvent eventemitter.EventType = "snapshot-sending-progress"
	ResumeSendingSnapshotEvent   eventemitter.EventType = "resume-sending-snapshot"
	SentSnapshotEvent            eventemitter.EventType = "sent-snapshot"
	MarkSnapshotDeletionEvent    eventemitter.EventType = "mark-snapshot-deletion"
	DeletedSnapshotEvent         eventemitter.EventType = "deleted-snapshot"
	DeletedFilesystemEvent       eventemitter.EventType = "deleted-filesystem"
)

Variables

View Source
var (
	ErrNoCommonSnapshots = errors.New("local and remote datasets have no common snapshot")
	ErrNoLocalSnapshots  = errors.New("no local snapshots to send")
)

Functions

This section is empty.

Types

type Config

type Config struct {
	ParentDataset        string            `json:"ParentDataset" yaml:"ParentDataset"`
	DatasetType          zfs.DatasetType   `json:"DatasetTypes" yaml:"DatasetTypes"`
	HTTPHeaders          map[string]string `json:"HTTPHeaders" yaml:"HTTPHeaders"`
	SnapshotNameTemplate string            `json:"SnapshotNameTemplate" yaml:"SnapshotNameTemplate"`

	EnableSnapshotCreate     bool `json:"EnableSnapshotCreate" yaml:"EnableSnapshotCreate"`
	EnableSnapshotSend       bool `json:"EnableSnapshotSend" yaml:"EnableSnapshotSend"`
	EnableSnapshotMark       bool `json:"EnableSnapshotMark" yaml:"EnableSnapshotMark"`
	EnableSnapshotMarkRemote bool `json:"EnableSnapshotMarkRemote" yaml:"EnableSnapshotMarkRemote"`
	EnableSnapshotPrune      bool `json:"EnableSnapshotPrune" yaml:"EnableSnapshotPrune"`
	EnableFilesystemPrune    bool `json:"EnableFilesystemPrune" yaml:"EnableFilesystemPrune"`

	SendRoutines          int               `json:"SendRoutines" yaml:"SendRoutines"`
	SendResumable         bool              `json:"SendResumable" yaml:"SendResumable"`
	SendRaw               bool              `json:"SendRaw" yaml:"SendRaw"`
	SendIncludeProperties bool              `json:"SendIncludeProperties" yaml:"SendIncludeProperties"`
	SendCopyProperties    []string          `json:"SendCopyProperties" yaml:"SendCopyProperties"`
	SendSetProperties     map[string]string `json:"SendSetProperties" yaml:"SendSetProperties"`

	IgnoreSnapshotsWithoutCreatedProperty bool `json:"IgnoreSnapshotsWithoutCreatedProperty" yaml:"IgnoreSnapshotsWithoutCreatedProperty"`

	SendCompressionLevel                 zstd.EncoderLevel `json:"SendCompressionLevel" yaml:"SendCompressionLevel"`
	SendSpeedBytesPerSecond              int64             `json:"SendSpeedBytesPerSecond" yaml:"SendSpeedBytesPerSecond"`
	SendProgressEventIntervalSeconds     int64             `json:"SendProgressEventIntervalSeconds" yaml:"SendProgressEventIntervalSeconds"`
	MaximumSendTimeSeconds               int64             `json:"MaximumSendTimeSeconds" yaml:"MaximumSendTimeSeconds"`
	MaximumRemoteSnapshotCacheAgeSeconds int64             `json:"MaximumRemoteSnapshotCacheAgeSeconds" yaml:"MaximumRemoteSnapshotCacheAgeSeconds"`

	Properties Properties `json:"Properties" yaml:"Properties"`
}

Config configures the runner

func (*Config) ApplyDefaults

func (c *Config) ApplyDefaults()

ApplyDefaults applies all the default values to the configuration

type Properties

type Properties struct {
	Namespace string `json:"Namespace" yaml:"Namespace"`

	DatasetLocked            string `json:"DatasetLocked" yaml:"DatasetLocked"`
	SnapshotIntervalMinutes  string `json:"SnapshotIntervalMinutes" yaml:"SnapshotIntervalMinutes"`
	SnapshotCreatedAt        string `json:"SnapshotCreatedAt" yaml:"SnapshotCreatedAt"`
	SnapshotSendTo           string `json:"SnapshotSendTo" yaml:"SnapshotSendTo"`
	SnapshotSending          string `json:"SnapshotSending" yaml:"SnapshotSending"`
	SnapshotSentAt           string `json:"SnapshotSentAt" yaml:"SnapshotSentAt"`
	SnapshotRetentionCount   string `json:"SnapshotRetentionCount" yaml:"SnapshotRetentionCount"`
	SnapshotRetentionMinutes string `json:"SnapshotRetentionMinutes" yaml:"SnapshotRetentionMinutes"`
	DeleteAt                 string `json:"DeleteAt" yaml:"DeleteAt"`
	DeleteWithoutSnapshots   string `json:"DeleteWithoutSnapshots" yaml:"DeleteWithoutSnapshots"`
}

Properties sets the names of the custom ZFS properties to use

func (*Properties) ApplyDefaults

func (p *Properties) ApplyDefaults()

ApplyDefaults applies all the default values to the Properties

type Runner

type Runner struct {
	*eventemitter.Emitter
	// contains filtered or unexported fields
}

Runner runs Create, ZFSSending and Prune snapshot jobs. Additionally, it can prune filesystems.

func NewRunner

func NewRunner(ctx context.Context, conf Config, logger *slog.Logger) *Runner

NewRunner creates a new job runner

func (*Runner) ListCurrentSends added in v0.9.3

func (r *Runner) ListCurrentSends() []ZFSSend

ListCurrentSends returns a list of current ZFS sends in progress

func (*Runner) Run

func (r *Runner) Run()

Run starts the goroutines for the different types of jobs

func (*Runner) SendDataset added in v0.9.5

func (r *Runner) SendDataset(dataset string)

SendDataset can be used to trigger send for a specific dataset. Do not include the snapshot part of the dataset. Blocking call, will block until one of the send goroutines has picked up the call. If sending is disabled, will block forever.

type ZFSSend added in v0.9.4

type ZFSSend interface {
	// Dataset returns the full Dataset(=Snapshot) that is sent
	Dataset() string
	// DatasetName returns the dataset name
	DatasetName() string
	// SnapshotName returns the snapshot name
	SnapshotName() string
	// Server returns the URL the snapshot is being sent to
	Server() string
	// BytesSent returns how many bytes have been sent
	BytesSent() int64
	// UpdatedAt returns when this was last updated
	UpdatedAt() time.Time
	// StartedAt returns when send was started
	StartedAt() time.Time
	// CancelSend cancels the send process
	CancelSend()
}

ZFSSend represents a ZFS send process

Jump to

Keyboard shortcuts

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