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

View File

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

View File

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

View File

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