implement local replication using new local transport

The new local transport uses socketpair() and a switchboard based on
client identities.
The special local job type is gone, which is good since it does not fit
into the 'Active/Passive side ' + 'mode' concept used to implement the
duality of push/sink | pull/source.
This commit is contained in:
Christian Schwarz
2018-09-24 14:43:53 +02:00
parent f3e8eda04d
commit 1ce0c69e4f
6 changed files with 279 additions and 34 deletions
+11 -11
View File
@@ -59,16 +59,6 @@ type SourceJob struct {
Filesystems FilesystemsFilter `yaml:"filesystems"`
}
type LocalJob struct {
Type string `yaml:"type"`
Name string `yaml:"name"`
Filesystems FilesystemsFilter `yaml:"filesystems"`
RootDataset string `yaml:"root_dataset"`
Snapshotting Snapshotting `yaml:"snapshotting"`
Pruning PruningSenderReceiver `yaml:"pruning"`
Debug JobDebugSettings `yaml:"debug,optional"`
}
type FilesystemsFilter map[string]bool
type Snapshotting struct {
@@ -171,6 +161,11 @@ type SSHStdinserverConnect struct {
DialTimeout time.Duration `yaml:"dial_timeout,positive,default=10s"`
}
type LocalConnect struct {
ConnectCommon `yaml:",inline"`
ClientIdentity string `yaml:"client_identity"`
}
type ServeEnum struct {
Ret interface{}
}
@@ -201,6 +196,10 @@ type StdinserverServer struct {
ClientIdentities []string `yaml:"client_identities"`
}
type LocalServe struct {
ServeCommon `yaml:",inline"`
}
type PruningEnum struct {
Ret interface{}
}
@@ -311,7 +310,6 @@ func (t *JobEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error) {
"sink": &SinkJob{},
"pull": &PullJob{},
"source": &SourceJob{},
"local": &LocalJob{},
})
return
}
@@ -321,6 +319,7 @@ func (t *ConnectEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error)
"tcp": &TCPConnect{},
"tls": &TLSConnect{},
"ssh+stdinserver": &SSHStdinserverConnect{},
"local": &LocalConnect{},
})
return
}
@@ -330,6 +329,7 @@ func (t *ServeEnum) UnmarshalYAML(u func(interface{}, bool) error) (err error) {
"tcp": &TCPServe{},
"tls": &TLSServe{},
"stdinserver": &StdinserverServer{},
"local" : &LocalServe{},
})
return
}
+25 -23
View File
@@ -1,26 +1,28 @@
jobs:
- name: mirror_local
type: local
# snapshot the filesystems matched by the left-hand-side of the mapping
# every 10m with zrepl_ as prefix
filesystems: {
"pool1/var/db<": true,
"pool1/usr/home<": true,
"pool1/usr/home/paranoid": false, #don't backup paranoid user
"pool1/poudriere/ports<": false #don't backup the ports trees
}
# TODO FIXME enforce that the tree under root_dataset and the trees allowed (true) by filesystems are non-overlapping
root_dataset: "pool2/backups/pool1"
- type: sink
name: "local_sink"
root_dataset: "storage/zrepl/sink"
serve:
type: local
snapshotting:
snapshot_prefix: zrepl_
interval: 10m
pruning:
keep_sender:
- type: not_replicated
keep_receiver:
- type: grid
grid: 1x1h(keep=all) | 24x1h | 35x1d | 6x30d
keep_bookmarks: all
- type: push
name: "backup_system"
connect:
type: local
client_identity: local_backup
filesystems: {
"system<": true,
}
snapshotting:
snapshot_prefix: zrepl_
interval: 10m
pruning:
keep_sender:
- type: not_replicated
- type: last_n
count: 10
keep_receiver:
- type: grid
grid: 1x1h(keep=all) | 24x1h | 35x1d | 6x30d
keep_bookmarks: all