config

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: Apr 6, 2019 License: MIT Imports: 11 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"`
	Debug   JobDebugSettings      `yaml:"debug,optional"`
}

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 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 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 JobDebugSettings

type JobDebugSettings struct {
	Conn *struct {
		ReadDump  string `yaml:"read_dump"`
		WriteDump string `yaml:"write_dump"`
	} `yaml:"conn,optional"`
	RPCLog bool `yaml:"rpc_log,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"`
}

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 PassiveJob

type PassiveJob struct {
	Type  string           `yaml:"type"`
	Name  string           `yaml:"name"`
	Serve ServeEnum        `yaml:"serve"`
	Debug JobDebugSettings `yaml:"debug,optional"`
}

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"`
}

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"`
}

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"`
}

type PushJob

type PushJob struct {
	ActiveJob    `yaml:",inline"`
	Snapshotting SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems  FilesystemsFilter `yaml:"filesystems"`
}

type RetentionInterval

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

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 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"`
}

type SnapJob

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

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 time.Duration `yaml:"interval,positive"`
}

type SourceJob

type SourceJob struct {
	PassiveJob   `yaml:",inline"`
	Snapshotting SnapshottingEnum  `yaml:"snapshotting"`
	Filesystems  FilesystemsFilter `yaml:"filesystems"`
}

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"`
	DialTimeout   time.Duration `yaml:"dial_timeout,zeropositive,default=10s"`
}

type TCPLoggingOutlet

type TCPLoggingOutlet struct {
	LoggingOutletCommon `yaml:",inline"`
	Address             string               `yaml:"address"`
	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"`
	Clients     map[string]string `yaml:"clients"`
}

type TLSConnect

type TLSConnect struct {
	ConnectCommon `yaml:",inline"`
	Address       string        `yaml:"address"`
	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"`
	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