config

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: 15 Imported by: 0

Documentation

Index

Constants

View Source
const RetentionGridKeepCountAll int = -1

Variables

View Source
var ConfigFileDefaultLocations = []string{
	"/etc/zrepl/zrepl.yml",
	"/usr/local/etc/zrepl/zrepl.yml",
}

Functions

func Validator added in v0.7.8

func Validator() *validator.Validate

Types

type ActiveJob

type ActiveJob struct {
	Type               string                   `yaml:"type" validate:"required"`
	Name               string                   `yaml:"name" validate:"required"`
	Connect            ConnectEnum              `yaml:"connect"`
	Pruning            PruningSenderReceiver    `yaml:"pruning" validate:"required"`
	Replication        Replication              `yaml:"replication"`
	ConflictResolution ConflictResolution       `yaml:"conflict_resolution"`
	MonitorSnapshots   MonitorSnapshots         `yaml:"monitor"`
	Interval           PositiveDurationOrManual `yaml:"interval"`
	Cron               string                   `yaml:"cron"`
}

func (*ActiveJob) CronSpec added in v0.7.4

func (self *ActiveJob) CronSpec() string

type BandwidthLimit added in v0.7.4

type BandwidthLimit struct {
	Max            datasizeunit.Bits `yaml:"max" default:"-1 B" validate:"required"`
	BucketCapacity datasizeunit.Bits `yaml:"bucket_capacity" default:"128 KiB" validate:"required"`
}

type Config

type Config struct {
	Jobs   []JobEnum `yaml:"jobs" validate:"min=1,dive"`
	Global Global    `yaml:"global"`
}

func New added in v0.7.5

func New() *Config

func ParseConfig

func ParseConfig(path string) (i *Config, err error)

func ParseConfigBytes

func ParseConfigBytes(bytes []byte) (*Config, error)

func (*Config) Job

func (c *Config) Job(name string) (*JobEnum, error)

type ConflictResolution added in v0.7.4

type ConflictResolution struct {
	InitialReplication string `yaml:"initial_replication" default:"all" validate:"required"`
}

type ConnectCommon

type ConnectCommon struct {
	Type string `yaml:"type" validate:"required"`
}

type ConnectEnum

type ConnectEnum struct {
	Ret any `validate:"required"`
}

func (*ConnectEnum) UnmarshalYAML

func (t *ConnectEnum) UnmarshalYAML(value *yaml.Node) (err error)

type Duration added in v0.7.4

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

func (Duration) Duration added in v0.7.4

func (d Duration) Duration() time.Duration

func (*Duration) UnmarshalYAML added in v0.7.4

func (d *Duration) UnmarshalYAML(value *yaml.Node) error

type FileLoggingOutlet added in v0.7.4

type FileLoggingOutlet struct {
	LoggingOutletCommon `yaml:",inline"`
	FileName            string `yaml:"filename"`
}

type FilesystemsFilter

type FilesystemsFilter map[string]bool

type Global

type Global struct {
	RpcTimeout time.Duration `yaml:"rpc_timeout" default:"1m" validate:"gt=0s"`
	ZfsBin     string        `yaml:"zfs_bin" default:"zfs" validate:"required"`

	Logging    LoggingOutletEnumList `yaml:"logging" validate:"min=1"`
	Monitoring []MonitoringEnum      `yaml:"monitoring"`
	Control    GlobalControl         `yaml:"control"`
	Serve      GlobalServe           `yaml:"serve"`
}

type GlobalControl

type GlobalControl struct {
	SockPath string `yaml:"sockpath" default:"/var/run/zrepl/control" validate:"required"`
}

type GlobalServe

type GlobalServe struct {
	StdinServer *GlobalStdinServer `yaml:"stdinserver" default:"{}" validate:"required"`
}

type GlobalStdinServer

type GlobalStdinServer struct {
	SockDir string `yaml:"sockdir" default:"/var/run/zrepl/stdinserver" validate:"required"`
}

type HookCommand added in v0.7.4

type HookCommand struct {
	Path               string            `yaml:"path" validate:"required"`
	Timeout            time.Duration     `yaml:"timeout" default:"30s" validate:"gt=0s"`
	Filesystems        FilesystemsFilter `yaml:"filesystems" validate:"min=1"`
	HookSettingsCommon `yaml:",inline"`
}

type HookEnum added in v0.7.4

type HookEnum struct {
	Ret any `validate:"required"`
}

func (*HookEnum) UnmarshalYAML added in v0.7.4

func (t *HookEnum) UnmarshalYAML(value *yaml.Node) (err error)

type HookList added in v0.7.4

type HookList []HookEnum

type HookSettingsCommon added in v0.7.4

type HookSettingsCommon struct {
	Type       string `yaml:"type" validate:"required"`
	ErrIsFatal bool   `yaml:"err_is_fatal"`
}

type JobEnum

type JobEnum struct {
	Ret any `validate:"required"`
}

func (JobEnum) Name

func (j JobEnum) Name() string

func (*JobEnum) UnmarshalYAML

func (t *JobEnum) UnmarshalYAML(value *yaml.Node) (err error)

type LocalConnect

type LocalConnect struct {
	ConnectCommon  `yaml:",inline"`
	ListenerName   string        `yaml:"listener_name" validate:"required"`
	ClientIdentity string        `yaml:"client_identity" validate:"required"`
	DialTimeout    time.Duration `yaml:"dial_timeout" default:"2s" validate:"min=0s"`
}

type LocalServe

type LocalServe struct {
	ServeCommon  `yaml:",inline"`
	ListenerName string `yaml:"listener_name" validate:"required"`
}

type LoggingOutletCommon

type LoggingOutletCommon struct {
	Type       string   `yaml:"type" validate:"required"`
	Level      string   `yaml:"level" validate:"required"`
	Format     string   `yaml:"format" validate:"required"`
	HideFields []string `yaml:"hide_fields"`
	Time       bool     `yaml:"time" default:"true"`
}

type LoggingOutletEnum

type LoggingOutletEnum struct {
	Ret any `validate:"required"`
}

func (*LoggingOutletEnum) UnmarshalYAML

func (t *LoggingOutletEnum) UnmarshalYAML(value *yaml.Node) (err error)

type LoggingOutletEnumList

type LoggingOutletEnumList []LoggingOutletEnum

func (*LoggingOutletEnumList) SetDefaults added in v0.7.8

func (l *LoggingOutletEnumList) SetDefaults()

type MonitorSnapshot added in v0.7.4

type MonitorSnapshot struct {
	Prefix   string        `yaml:"prefix"`
	Warning  time.Duration `yaml:"warning"`
	Critical time.Duration `yaml:"critical" validate:"required"`
}

type MonitorSnapshots added in v0.7.4

type MonitorSnapshots struct {
	Latest []MonitorSnapshot `yaml:"latest" validate:"dive"`
	Oldest []MonitorSnapshot `yaml:"oldest" validate:"dive"`
}

type MonitoringEnum

type MonitoringEnum struct {
	Ret any `validate:"required"`
}

func (*MonitoringEnum) UnmarshalYAML

func (t *MonitoringEnum) UnmarshalYAML(value *yaml.Node) (err error)

type ParseFlags added in v0.7.4

type ParseFlags uint
const (
	ParseFlagsNone        ParseFlags = 0
	ParseFlagsNoCertCheck ParseFlags = 1 << iota
)

type PassiveJob

type PassiveJob struct {
	Type             string           `yaml:"type" validate:"required"`
	Name             string           `yaml:"name" validate:"required"`
	Serve            ServeEnum        `yaml:"serve"`
	MonitorSnapshots MonitorSnapshots `yaml:"monitor"`
}

type PlaceholderRecvOptions added in v0.7.4

type PlaceholderRecvOptions struct {
	Encryption string `yaml:"encryption" default:"inherit" validate:"required"`
}

type PositiveDuration added in v0.7.4

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

func (PositiveDuration) Duration added in v0.7.4

func (d PositiveDuration) Duration() time.Duration

func (*PositiveDuration) UnmarshalYAML added in v0.7.4

func (d *PositiveDuration) UnmarshalYAML(value *yaml.Node) error

type PositiveDurationOrManual

type PositiveDurationOrManual struct {
	Interval time.Duration
	Manual   bool
}

func (*PositiveDurationOrManual) UnmarshalYAML

func (i *PositiveDurationOrManual) UnmarshalYAML(value *yaml.Node) (err error)

type PrometheusMonitoring

type PrometheusMonitoring struct {
	Type           string `yaml:"type" validate:"required"`
	Listen         string `yaml:"listen" validate:"required,hostname_port"`
	ListenFreeBind bool   `yaml:"listen_freebind"`
}

type PropertyRecvOptions added in v0.7.4

type PropertyRecvOptions struct {
	Inherit  []zfsprop.Property          `yaml:"inherit" validate:"dive,required"`
	Override map[zfsprop.Property]string `yaml:"override" validate:"dive,required"`
}

type PruneGrid

type PruneGrid struct {
	Type  string                `yaml:"type"`
	Grid  RetentionIntervalList `yaml:"grid"`
	Regex string                `yaml:"regex"`
}

type PruneKeepLastN

type PruneKeepLastN struct {
	Type  string `yaml:"type" validate:"required"`
	Count int    `yaml:"count" validate:"required"`
	Regex string `yaml:"regex"`
}

type PruneKeepNotReplicated

type PruneKeepNotReplicated struct {
	Type                 string `yaml:"type" validate:"required"`
	KeepSnapshotAtCursor bool   `yaml:"keep_snapshot_at_cursor" default:"true"`
}

type PruneKeepRegex

type PruneKeepRegex struct {
	Type   string `yaml:"type" validate:"required"`
	Regex  string `yaml:"regex" validate:"required"`
	Negate bool   `yaml:"negate"`
}

type PruningEnum

type PruningEnum struct {
	Ret any `validate:"required"`
}

func (*PruningEnum) UnmarshalYAML

func (t *PruningEnum) UnmarshalYAML(value *yaml.Node) (err error)

type PruningLocal

type PruningLocal struct {
	Keep []PruningEnum `yaml:"keep"`
}

type PruningSenderReceiver

type PruningSenderReceiver struct {
	KeepSender   []PruningEnum `yaml:"keep_sender"`
	KeepReceiver []PruningEnum `yaml:"keep_receiver"`
}

type PullJob

type PullJob struct {
	ActiveJob `yaml:",inline"`
	RootFS    string      `yaml:"root_fs" validate:"required"`
	Recv      RecvOptions `yaml:"recv"`
}

func (*PullJob) GetAppendClientIdentity added in v0.7.4

func (j *PullJob) GetAppendClientIdentity() bool

func (*PullJob) GetRecvOptions added in v0.7.4

func (j *PullJob) GetRecvOptions() *RecvOptions

func (*PullJob) GetRootFS added in v0.7.4

func (j *PullJob) GetRootFS() string

type PushJob

type PushJob struct {
	ActiveJob    `yaml:",inline"`
	Snapshotting SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems  FilesystemsFilter `yaml:"filesystems" validate:"min=1"`
	Send         SendOptions       `yaml:"send"`
}

func (*PushJob) GetFilesystems added in v0.7.4

func (j *PushJob) GetFilesystems() FilesystemsFilter

func (*PushJob) GetSendOptions added in v0.7.4

func (j *PushJob) GetSendOptions() *SendOptions

type RecvOptions added in v0.7.4

type RecvOptions struct {
	Properties     PropertyRecvOptions    `yaml:"properties"`
	BandwidthLimit BandwidthLimit         `yaml:"bandwidth_limit"`
	Placeholder    PlaceholderRecvOptions `yaml:"placeholder"`
	ExecPipe       [][]string             `yaml:"execpipe" validate:"dive,required"`
}

type Replication added in v0.7.4

type Replication struct {
	Protection  ReplicationOptionsProtection  `yaml:"protection"`
	Concurrency ReplicationOptionsConcurrency `yaml:"concurrency"`
	OneStep     bool                          `yaml:"one_step" default:"true"`
}

type ReplicationOptionsConcurrency added in v0.7.4

type ReplicationOptionsConcurrency struct {
	Steps         int `yaml:"steps" default:"1" validate:"min=1"`
	SizeEstimates int `yaml:"size_estimates" default:"4" validate:"min=1"`
}

type ReplicationOptionsProtection added in v0.7.4

type ReplicationOptionsProtection struct {
	Initial     string `yaml:"initial" default:"guarantee_resumability" validate:"required"`
	Incremental string `yaml:"incremental" default:"guarantee_resumability" validate:"required"`
}

type RetentionInterval

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

func ParseRetentionIntervalSpec added in v0.7.4

func ParseRetentionIntervalSpec(s string) (intervals []RetentionInterval, err error)

func (*RetentionInterval) KeepCount

func (i *RetentionInterval) KeepCount() int

func (*RetentionInterval) Length

func (i *RetentionInterval) Length() time.Duration

type RetentionIntervalList

type RetentionIntervalList []RetentionInterval

func (*RetentionIntervalList) UnmarshalYAML

func (t *RetentionIntervalList) UnmarshalYAML(value *yaml.Node) (err error)

type SSHStdinserverConnect

type SSHStdinserverConnect struct {
	ConnectCommon        `yaml:",inline"`
	Host                 string        `yaml:"host" validate:"required"`
	User                 string        `yaml:"user" validate:"required"`
	Port                 uint16        `yaml:"port" validate:"required"`
	IdentityFile         string        `yaml:"identity_file" validate:"required"`
	TransportOpenCommand []string      `yaml:"transport_open_command"` // TODO unused
	SSHCommand           string        `yaml:"ssh_command"`            // TODO unused
	Options              []string      `yaml:"options" validate:"dive,required"`
	DialTimeout          time.Duration `yaml:"dial_timeout" default:"10s" validate:"min=0s"`
}

type SendOptions added in v0.7.4

type SendOptions struct {
	Encrypted        bool `yaml:"encrypted"`
	Raw              bool `yaml:"raw"`
	SendProperties   bool `yaml:"send_properties"`
	BackupProperties bool `yaml:"backup_properties"`
	LargeBlocks      bool `yaml:"large_blocks"`
	Compressed       bool `yaml:"compressed"`
	EmbeddedData     bool `yaml:"embedded_data"`
	Saved            bool `yaml:"saved"`

	BandwidthLimit BandwidthLimit `yaml:"bandwidth_limit"`
	ExecPipe       [][]string     `yaml:"execpipe" validate:"dive,required"`
}

type ServeCommon

type ServeCommon struct {
	Type string `yaml:"type" validate:"required"`
}

type ServeEnum

type ServeEnum struct {
	Ret any `validate:"required"`
}

func (*ServeEnum) UnmarshalYAML

func (t *ServeEnum) UnmarshalYAML(value *yaml.Node) (err error)

type SinkJob

type SinkJob struct {
	PassiveJob `yaml:",inline"`
	RootFS     string      `yaml:"root_fs" validate:"required"`
	Recv       RecvOptions `yaml:"recv"`
}

func (*SinkJob) GetAppendClientIdentity added in v0.7.4

func (j *SinkJob) GetAppendClientIdentity() bool

func (*SinkJob) GetRecvOptions added in v0.7.4

func (j *SinkJob) GetRecvOptions() *RecvOptions

func (*SinkJob) GetRootFS added in v0.7.4

func (j *SinkJob) GetRootFS() string

type SnapJob

type SnapJob struct {
	Type             string            `yaml:"type" validate:"required"`
	Name             string            `yaml:"name" validate:"required"`
	Pruning          PruningLocal      `yaml:"pruning"`
	Snapshotting     SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems      FilesystemsFilter `yaml:"filesystems" validate:"min=1"`
	MonitorSnapshots MonitorSnapshots  `yaml:"monitor"`
}

type SnapshottingEnum

type SnapshottingEnum struct {
	Ret any `validate:"required"`
}

func (*SnapshottingEnum) UnmarshalYAML

func (t *SnapshottingEnum) UnmarshalYAML(value *yaml.Node) (err error)

type SnapshottingManual

type SnapshottingManual struct {
	Type string `yaml:"type" validate:"required"`
}

type SnapshottingPeriodic

type SnapshottingPeriodic struct {
	Type            string   `yaml:"type" validate:"required"`
	Prefix          string   `yaml:"prefix" validate:"required"`
	Interval        Duration `yaml:"interval"`
	Cron            string   `yaml:"cron"`
	Hooks           HookList `yaml:"hooks"`
	TimestampFormat string   `yaml:"timestamp_format" default:"dense" validate:"required"`
	TimestampLocal  bool     `yaml:"timestamp_local"`
}

func (*SnapshottingPeriodic) CronSpec added in v0.7.4

func (self *SnapshottingPeriodic) CronSpec() string

type SourceJob

type SourceJob struct {
	PassiveJob   `yaml:",inline"`
	Snapshotting SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems  FilesystemsFilter `yaml:"filesystems" validate:"min=1"`
	Send         SendOptions       `yaml:"send"`
}

func (*SourceJob) GetFilesystems added in v0.7.4

func (j *SourceJob) GetFilesystems() FilesystemsFilter

func (*SourceJob) GetSendOptions added in v0.7.4

func (j *SourceJob) GetSendOptions() *SendOptions

type StdinserverServer

type StdinserverServer struct {
	ServeCommon      `yaml:",inline"`
	ClientIdentities []string `yaml:"client_identities" validate:"dive,required"`
}

type SyslogFacility

type SyslogFacility syslog.Priority

func (*SyslogFacility) SetDefaults added in v0.7.8

func (f *SyslogFacility) SetDefaults()

func (*SyslogFacility) UnmarshalJSON added in v0.7.8

func (f *SyslogFacility) UnmarshalJSON(b []byte) error

func (*SyslogFacility) UnmarshalYAML

func (t *SyslogFacility) UnmarshalYAML(value *yaml.Node) (err error)

type SyslogLoggingOutlet

type SyslogLoggingOutlet struct {
	LoggingOutletCommon `yaml:",inline"`
	Facility            SyslogFacility `yaml:"facility" default:"local0" validate:"required"`
	RetryInterval       time.Duration  `yaml:"retry_interval" default:"10s" validate:"gt=0s"`
}

type TCPConnect

type TCPConnect struct {
	ConnectCommon `yaml:",inline"`
	Address       string        `yaml:"address" validate:"required,hostname_port"`
	DialTimeout   time.Duration `yaml:"dial_timeout" default:"10s" validate:"min=0s"`
}

type TCPLoggingOutlet

type TCPLoggingOutlet struct {
	LoggingOutletCommon `yaml:",inline"`
	Address             string               `yaml:"address" validate:"required,hostname_port"`
	Net                 string               `yaml:"net" default:"tcp" validate:"required"`
	RetryInterval       time.Duration        `yaml:"retry_interval" default:"10s" validate:"gt=0s"`
	TLS                 *TCPLoggingOutletTLS `yaml:"tls"`
}

type TCPLoggingOutletTLS

type TCPLoggingOutletTLS struct {
	CA   string `yaml:"ca" validate:"required"`
	Cert string `yaml:"cert" validate:"required"`
	Key  string `yaml:"key" validate:"required"`
}

type TCPServe

type TCPServe struct {
	ServeCommon    `yaml:",inline"`
	Listen         string            `yaml:"listen" validate:"required,hostname_port"`
	ListenFreeBind bool              `yaml:"listen_freebind"`
	Clients        map[string]string `yaml:"clients" validate:"dive,required"`
}

type TLSConnect

type TLSConnect struct {
	ConnectCommon `yaml:",inline"`
	Address       string        `yaml:"address" validate:"required,hostname_port"`
	Ca            string        `yaml:"ca" validate:"required"`
	Cert          string        `yaml:"cert" validate:"required"`
	Key           string        `yaml:"key" validate:"required"`
	ServerCN      string        `yaml:"server_cn" validate:"required"`
	DialTimeout   time.Duration `yaml:"dial_timeout" default:"10s" validate:"min=0s"`
}

type TLSServe

type TLSServe struct {
	ServeCommon      `yaml:",inline"`
	Listen           string        `yaml:"listen" validate:"required,hostname_port"`
	ListenFreeBind   bool          `yaml:"listen_freebind"`
	Ca               string        `yaml:"ca" validate:"required"`
	Cert             string        `yaml:"cert" validate:"required"`
	Key              string        `yaml:"key" validate:"required"`
	ClientCNs        []string      `yaml:"client_cns" validate:"dive,required"`
	HandshakeTimeout time.Duration `yaml:"handshake_timeout" default:"10s" validate:"min=0s"`
}

Jump to

Keyboard shortcuts

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