config

package
v0.6.1 Latest Latest
Warning

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

Go to latest
Published: Sep 10, 2023 License: MIT Imports: 16 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 Default

func Default(i interface{})

Types

type ActiveJob

type ActiveJob struct {
	Type               string                `yaml:"type"`
	Name               string                `yaml:"name"`
	Connect            ConnectEnum           `yaml:"connect"`
	Pruning            PruningSenderReceiver `yaml:"pruning"`
	Replication        *Replication          `yaml:"replication,optional,fromdefaults"`
	ConflictResolution *ConflictResolution   `yaml:"conflict_resolution,optional,fromdefaults"`
}

type BandwidthLimit added in v0.5.0

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

type Config

type Config struct {
	Jobs   []JobEnum `yaml:"jobs"`
	Global *Global   `yaml:"global,optional,fromdefaults"`
}

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.6.0

type ConflictResolution struct {
	InitialReplication string `yaml:"initial_replication,optional,default=most_recent"`
}

type ConnectCommon

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

type ConnectEnum

type ConnectEnum struct {
	Ret interface{}
}

func (*ConnectEnum) UnmarshalYAML

func (t *ConnectEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type CronSpec added in v0.6.0

type CronSpec struct {
	Schedule cron.Schedule
}

func (*CronSpec) UnmarshalYAML added in v0.6.0

func (s *CronSpec) UnmarshalYAML(unmarshal func(v interface{}, not_strict bool) error) error

type Duration added in v0.6.0

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

func (Duration) Duration added in v0.6.0

func (d Duration) Duration() time.Duration

func (*Duration) UnmarshalYAML added in v0.6.0

func (d *Duration) UnmarshalYAML(unmarshal func(v interface{}, not_strict bool) error) error

type FilesystemsFilter

type FilesystemsFilter map[string]bool

type Global

type Global struct {
	Logging    *LoggingOutletEnumList `yaml:"logging,optional,fromdefaults"`
	Monitoring []MonitoringEnum       `yaml:"monitoring,optional"`
	Control    *GlobalControl         `yaml:"control,optional,fromdefaults"`
	Serve      *GlobalServe           `yaml:"serve,optional,fromdefaults"`
}

type GlobalControl

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

type GlobalServe

type GlobalServe struct {
	StdinServer *GlobalStdinServer `yaml:"stdinserver,optional,fromdefaults"`
}

type GlobalStdinServer

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

type HookCommand added in v0.2.0

type HookCommand struct {
	Path               string            `yaml:"path"`
	Timeout            time.Duration     `yaml:"timeout,optional,positive,default=30s"`
	Filesystems        FilesystemsFilter `yaml:"filesystems,optional,default={'<': true}"`
	HookSettingsCommon `yaml:",inline"`
}

type HookEnum added in v0.2.0

type HookEnum struct {
	Ret interface{}
}

func (*HookEnum) UnmarshalYAML added in v0.2.0

func (t *HookEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type HookList added in v0.2.0

type HookList []HookEnum

type HookMySQLLockTables added in v0.2.0

type HookMySQLLockTables struct {
	HookSettingsCommon `yaml:",inline"`
	DSN                string            `yaml:"dsn"`
	Timeout            time.Duration     `yaml:"timeout,optional,positive,default=30s"`
	Filesystems        FilesystemsFilter `yaml:"filesystems"`
}

type HookPostgresCheckpoint added in v0.2.0

type HookPostgresCheckpoint struct {
	HookSettingsCommon `yaml:",inline"`
	DSN                string            `yaml:"dsn"`
	Timeout            time.Duration     `yaml:"timeout,optional,positive,default=30s"`
	Filesystems        FilesystemsFilter `yaml:"filesystems"` // required, user should not CHECKPOINT for every FS
}

type HookSettingsCommon added in v0.2.0

type HookSettingsCommon struct {
	Type       string `yaml:"type"`
	ErrIsFatal bool   `yaml:"err_is_fatal,optional,default=false"`
}

type JobEnum

type JobEnum struct {
	Ret interface{}
}

func (JobEnum) Name

func (j JobEnum) Name() string

func (*JobEnum) UnmarshalYAML

func (t *JobEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type LocalConnect

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

type LocalServe

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

type LoggingOutletCommon

type LoggingOutletCommon struct {
	Type   string `yaml:"type"`
	Level  string `yaml:"level"`
	Format string `yaml:"format"`
}

type LoggingOutletEnum

type LoggingOutletEnum struct {
	Ret interface{}
}

func (*LoggingOutletEnum) UnmarshalYAML

func (t *LoggingOutletEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type LoggingOutletEnumList

type LoggingOutletEnumList []LoggingOutletEnum

func (*LoggingOutletEnumList) SetDefault

func (l *LoggingOutletEnumList) SetDefault()

type MonitoringEnum

type MonitoringEnum struct {
	Ret interface{}
}

func (*MonitoringEnum) UnmarshalYAML

func (t *MonitoringEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type ParseFlags added in v0.6.0

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

type PassiveJob

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

type PlaceholderRecvOptions added in v0.5.0

type PlaceholderRecvOptions struct {
	Encryption string `yaml:"encryption,default=unspecified"`
}

type PositiveDuration added in v0.6.0

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

func (PositiveDuration) Duration added in v0.6.0

func (d PositiveDuration) Duration() time.Duration

func (*PositiveDuration) UnmarshalYAML added in v0.6.0

func (d *PositiveDuration) UnmarshalYAML(unmarshal func(v interface{}, not_strict bool) error) error

type PositiveDurationOrManual

type PositiveDurationOrManual struct {
	Interval time.Duration
	Manual   bool
}

func (*PositiveDurationOrManual) UnmarshalYAML

func (i *PositiveDurationOrManual) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type PrometheusMonitoring

type PrometheusMonitoring struct {
	Type           string `yaml:"type"`
	Listen         string `yaml:"listen,hostport"`
	ListenFreeBind bool   `yaml:"listen_freebind,default=false"`
}

type PropertyRecvOptions added in v0.4.0

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

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"`
	Count int    `yaml:"count"`
	Regex string `yaml:"regex,optional"`
}

type PruneKeepNotReplicated

type PruneKeepNotReplicated struct {
	Type                 string `yaml:"type"`
	KeepSnapshotAtCursor bool   `yaml:"keep_snapshot_at_cursor,optional,default=true"`
}

type PruneKeepRegex

type PruneKeepRegex struct {
	Type   string `yaml:"type"`
	Regex  string `yaml:"regex"`
	Negate bool   `yaml:"negate,optional,default=false"`
}

type PruningEnum

type PruningEnum struct {
	Ret interface{}
}

func (*PruningEnum) UnmarshalYAML

func (t *PruningEnum) UnmarshalYAML(u func(interface{}, bool) error) (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"`
	Interval  PositiveDurationOrManual `yaml:"interval"`
	Recv      *RecvOptions             `yaml:"recv,fromdefaults,optional"`
}

func (*PullJob) GetAppendClientIdentity added in v0.3.0

func (j *PullJob) GetAppendClientIdentity() bool

func (*PullJob) GetRecvOptions added in v0.3.0

func (j *PullJob) GetRecvOptions() *RecvOptions

func (*PullJob) GetRootFS added in v0.3.0

func (j *PullJob) GetRootFS() string

type PushJob

type PushJob struct {
	ActiveJob    `yaml:",inline"`
	Snapshotting SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems  FilesystemsFilter `yaml:"filesystems"`
	Send         *SendOptions      `yaml:"send,fromdefaults,optional"`
}

func (*PushJob) GetFilesystems added in v0.3.0

func (j *PushJob) GetFilesystems() FilesystemsFilter

func (*PushJob) GetSendOptions added in v0.3.0

func (j *PushJob) GetSendOptions() *SendOptions

type RecvOptions added in v0.3.0

type RecvOptions struct {
	Properties *PropertyRecvOptions `yaml:"properties,fromdefaults"`

	BandwidthLimit *BandwidthLimit `yaml:"bandwidth_limit,optional,fromdefaults"`

	Placeholder *PlaceholderRecvOptions `yaml:"placeholder,fromdefaults"`
}

type Replication added in v0.3.0

type Replication struct {
	Protection  *ReplicationOptionsProtection  `yaml:"protection,optional,fromdefaults"`
	Concurrency *ReplicationOptionsConcurrency `yaml:"concurrency,optional,fromdefaults"`
}

type ReplicationOptionsConcurrency added in v0.4.0

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

type ReplicationOptionsProtection added in v0.3.0

type ReplicationOptionsProtection struct {
	Initial     string `yaml:"initial,optional,default=guarantee_resumability"`
	Incremental string `yaml:"incremental,optional,default=guarantee_resumability"`
}

type RetentionInterval

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

func ParseRetentionIntervalSpec added in v0.3.1

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(u func(interface{}, bool) error) (err error)

type SSHStdinserverConnect

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

type SendOptions added in v0.3.0

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

	BandwidthLimit *BandwidthLimit `yaml:"bandwidth_limit,optional,fromdefaults"`
}

type ServeCommon

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

type ServeEnum

type ServeEnum struct {
	Ret interface{}
}

func (*ServeEnum) UnmarshalYAML

func (t *ServeEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type SinkJob

type SinkJob struct {
	PassiveJob `yaml:",inline"`
	RootFS     string       `yaml:"root_fs"`
	Recv       *RecvOptions `yaml:"recv,optional,fromdefaults"`
}

func (*SinkJob) GetAppendClientIdentity added in v0.3.0

func (j *SinkJob) GetAppendClientIdentity() bool

func (*SinkJob) GetRecvOptions added in v0.3.0

func (j *SinkJob) GetRecvOptions() *RecvOptions

func (*SinkJob) GetRootFS added in v0.3.0

func (j *SinkJob) GetRootFS() string

type SnapJob

type SnapJob struct {
	Type         string            `yaml:"type"`
	Name         string            `yaml:"name"`
	Pruning      PruningLocal      `yaml:"pruning"`
	Snapshotting SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems  FilesystemsFilter `yaml:"filesystems"`
}

type SnapshottingCron added in v0.6.0

type SnapshottingCron struct {
	Type            string   `yaml:"type"`
	Prefix          string   `yaml:"prefix"`
	Cron            CronSpec `yaml:"cron"`
	Hooks           HookList `yaml:"hooks,optional"`
	TimestampFormat string   `yaml:"timestamp_format,optional,default=dense"`
}

type SnapshottingEnum

type SnapshottingEnum struct {
	Ret interface{}
}

func (*SnapshottingEnum) UnmarshalYAML

func (t *SnapshottingEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type SnapshottingManual

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

type SnapshottingPeriodic

type SnapshottingPeriodic struct {
	Type            string            `yaml:"type"`
	Prefix          string            `yaml:"prefix"`
	Interval        *PositiveDuration `yaml:"interval"`
	Hooks           HookList          `yaml:"hooks,optional"`
	TimestampFormat string            `yaml:"timestamp_format,optional,default=dense"`
}

type SourceJob

type SourceJob struct {
	PassiveJob   `yaml:",inline"`
	Snapshotting SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems  FilesystemsFilter `yaml:"filesystems"`
	Send         *SendOptions      `yaml:"send,optional,fromdefaults"`
}

func (*SourceJob) GetFilesystems added in v0.3.0

func (j *SourceJob) GetFilesystems() FilesystemsFilter

func (*SourceJob) GetSendOptions added in v0.3.0

func (j *SourceJob) GetSendOptions() *SendOptions

type StdinserverServer

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

type StdoutLoggingOutlet

type StdoutLoggingOutlet struct {
	LoggingOutletCommon `yaml:",inline"`
	Time                bool `yaml:"time,default=true"`
	Color               bool `yaml:"color,default=true"`
}

type SyslogFacility

type SyslogFacility syslog.Priority

func (*SyslogFacility) SetDefault

func (f *SyslogFacility) SetDefault()

func (*SyslogFacility) UnmarshalYAML

func (t *SyslogFacility) UnmarshalYAML(u func(interface{}, bool) error) (err error)

type SyslogLoggingOutlet

type SyslogLoggingOutlet struct {
	LoggingOutletCommon `yaml:",inline"`
	Facility            *SyslogFacility `yaml:"facility,optional,fromdefaults"`
	RetryInterval       time.Duration   `yaml:"retry_interval,positive,default=10s"`
}

type TCPConnect

type TCPConnect struct {
	ConnectCommon `yaml:",inline"`
	Address       string        `yaml:"address,hostport"`
	DialTimeout   time.Duration `yaml:"dial_timeout,zeropositive,default=10s"`
}

type TCPLoggingOutlet

type TCPLoggingOutlet struct {
	LoggingOutletCommon `yaml:",inline"`
	Address             string               `yaml:"address,hostport"`
	Net                 string               `yaml:"net,default=tcp"`
	RetryInterval       time.Duration        `yaml:"retry_interval,positive,default=10s"`
	TLS                 *TCPLoggingOutletTLS `yaml:"tls,optional"`
}

type TCPLoggingOutletTLS

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

type TCPServe

type TCPServe struct {
	ServeCommon    `yaml:",inline"`
	Listen         string            `yaml:"listen,hostport"`
	ListenFreeBind bool              `yaml:"listen_freebind,default=false"`
	Clients        map[string]string `yaml:"clients"`
}

type TLSConnect

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

type TLSServe

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

Jump to

Keyboard shortcuts

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