add to config

This commit is contained in:
Anton Schirg 2018-08-27 15:18:08 +02:00
parent ecd9db4ac6
commit b955d308d9
4 changed files with 72 additions and 41 deletions

View File

@ -26,12 +26,14 @@ type PushJob struct {
Replication PushReplication `yaml:"replication"`
Snapshotting Snapshotting `yaml:"snapshotting"`
Pruning PruningSenderReceiver `yaml:"pruning"`
Debug JobDebugSettings `yaml:"debug,optional"`
}
type SinkJob struct {
Type string `yaml:"type"`
Name string `yaml:"name"`
Replication SinkReplication `yaml:"replication"`
Debug JobDebugSettings `yaml:"debug,optional"`
}
type PullJob struct {
@ -39,11 +41,13 @@ type PullJob struct {
Name string `yaml:"name"`
Replication PullReplication `yaml:"replication"`
Pruning PruningSenderReceiver `yaml:"pruning"`
Debug JobDebugSettings `yaml:"debug,optional"`
}
type PullReplication struct {
Connect ConnectEnum `yaml:"connect"`
RootDataset string `yaml:"root_dataset"`
Interval time.Duration `yaml:"interval,positive"`
}
type SourceJob struct {
@ -52,6 +56,7 @@ type SourceJob struct {
Replication SourceReplication `yaml:"replication"`
Snapshotting Snapshotting `yaml:"snapshotting"`
Pruning PruningLocal `yaml:"pruning"`
Debug JobDebugSettings `yaml:"debug,optional"`
}
type LocalJob struct {
@ -60,6 +65,7 @@ type LocalJob struct {
Replication LocalReplication `yaml:"replication"`
Snapshotting Snapshotting `yaml:"snapshotting"`
Pruning PruningSenderReceiver `yaml:"pruning"`
Debug JobDebugSettings `yaml:"debug,optional"`
}
type PushReplication struct {
@ -84,7 +90,7 @@ type LocalReplication struct {
type Snapshotting struct {
SnapshotPrefix string `yaml:"snapshot_prefix"`
Interval time.Duration `yaml:"interval"`
Interval time.Duration `yaml:"interval,positive"`
}
type PruningSenderReceiver struct {
@ -110,6 +116,7 @@ type ConnectEnum struct {
type TCPConnect struct {
Type string `yaml:"type"`
Address string `yaml:"address"`
DialTimeout time.Duration `yaml:"dial_timeout,positive,default=10s"`
}
type TLSConnect struct {
@ -118,6 +125,8 @@ type TLSConnect struct {
Ca string `yaml:"ca"`
Cert string `yaml:"cert"`
Key string `yaml:"key"`
ServerCN string `yaml:"server_cn"`
DialTimeout time.Duration `yaml:"dial_timeout,positive,default=10s"`
}
type SSHStdinserverConnect struct {
@ -126,7 +135,10 @@ type SSHStdinserverConnect struct {
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"`
DialTimeout time.Duration `yaml:"dial_timeout,positive,default=10s"`
}
type ServeEnum struct {
@ -145,6 +157,7 @@ type TLSServe struct {
Ca string `yaml:"ca"`
Cert string `yaml:"cert"`
Key string `yaml:"key"`
ClientCN string `yaml:"client_cn"`
}
type StdinserverServer struct {
@ -165,6 +178,11 @@ type PruneKeepLastN struct {
Count int `yaml:"count"`
}
type PruneKeepPrefix struct { // FIXME rename to KeepPrefix
Type string `yaml:"type"`
Prefix string `yaml:"prefix"`
}
type LoggingOutletEnum struct {
Ret interface{}
}
@ -182,14 +200,14 @@ type StdoutLoggingOutlet struct {
type SyslogLoggingOutlet struct {
LoggingOutletCommon `yaml:",inline"`
RetryInterval time.Duration `yaml:"retry_interval"`
RetryInterval time.Duration `yaml:"retry_interval,positive"`
}
type TCPLoggingOutlet struct {
LoggingOutletCommon `yaml:",inline"`
Address string `yaml:"address"`
Net string `yaml:"net,default=tcp"`
RetryInterval time.Duration `yaml:"retry_interval"`
RetryInterval time.Duration `yaml:"retry_interval,positive"`
TLS *TCPLoggingOutletTLS `yaml:"tls,optional"`
}
@ -220,6 +238,13 @@ type GlobalStdinServer struct {
SockDir string `yaml:"sockdir,default=/var/run/zrepl/stdinserver"`
}
type JobDebugSettings struct {
Conn struct {
ReadDump string `yaml:"read_dump"`
WriteDump string `yaml:"write_dump"`
} `yaml:"conn"`
}
func enumUnmarshal(u func(interface{}, bool) error, types map[string]interface{}) (interface{}, error) {
var in struct {
Type string
@ -275,6 +300,7 @@ func (t *PruningEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)
"not_replicated": &PruneKeepNotReplicated{},
"last_n": &PruneKeepLastN{},
"grid": &PruneGrid{},
"prefix": &PruneKeepPrefix{},
})
return
}

View File

@ -1,15 +1,16 @@
jobs:
- name: pull_servers
type: pull
replication:
connect:
type: tls
address: "server1.foo.bar:8888"
ca: /certs/ca.crt
cert: /certs/cert.crt
key: /certs/key.pem
ca: "/certs/ca.crt"
cert: "/certs/cert.crt"
key: "/certs/key.pem"
server_cn: "server1"
root_dataset: "pool2/backup_servers"
interval: 10m
pruning:
keep_sender:
- type: not_replicated

View File

@ -12,6 +12,7 @@ jobs:
options: # optional, default [], `-o` arguments passed to ssh
- "Compression=on"
root_dataset: "pool2/backup_servers"
interval: 10m
pruning:
keep_sender:
- type: not_replicated
@ -21,6 +22,8 @@ jobs:
grid: 1x1h(keep=all) | 24x1h | 14x1d
keep_bookmarks: all
keep_receiver:
- type: prefix
prefix: keep_
- type: grid
grid: 1x1h(keep=all) | 24x1h | 35x1d | 6x30d
keep_bookmarks: all

View File

@ -9,6 +9,7 @@ jobs:
ca: "ca.pem"
cert: "cert.pem"
key: "key.pem"
client_cn: "laptop1"
global:
logging:
- type: "tcp"