initial repl policy: get rid of unimplemented options

This commit is contained in:
Christian Schwarz
2018-08-25 22:23:47 +02:00
parent 861e5f8313
commit 88de8ba8bb
9 changed files with 4 additions and 60 deletions
-5
View File
@@ -17,7 +17,6 @@ type LocalJob struct {
Mapping *DatasetMapFilter
SnapshotPrefix string
Interval time.Duration
InitialReplPolicy replication.InitialReplPolicy
PruneLHS PrunePolicy
PruneRHS PrunePolicy
Debug JobDebugSettings
@@ -60,10 +59,6 @@ func parseLocalJob(c JobParsingContext, name string, i map[string]interface{}) (
return
}
if j.InitialReplPolicy, err = parseInitialReplPolicy(asMap.InitialReplPolicy, replication.DEFAULT_INITIAL_REPL_POLICY); err != nil {
return
}
if j.PruneLHS, err = parsePrunePolicy(asMap.PruneLHS, true); err != nil {
err = errors.Wrap(err, "cannot parse 'prune_lhs'")
return
-7
View File
@@ -23,7 +23,6 @@ type PullJob struct {
// constructed from mapping during parsing
pruneFilter *DatasetMapFilter
SnapshotPrefix string
InitialReplPolicy replication.InitialReplPolicy
Prune PrunePolicy
Debug JobDebugSettings
@@ -72,12 +71,6 @@ func parsePullJob(c JobParsingContext, name string, i map[string]interface{}) (j
return nil, err
}
j.InitialReplPolicy, err = parseInitialReplPolicy(asMap.InitialReplPolicy, replication.DEFAULT_INITIAL_REPL_POLICY)
if err != nil {
err = errors.Wrap(err, "cannot parse 'initial_repl_policy'")
return
}
if j.SnapshotPrefix, err = parseSnapshotPrefix(asMap.SnapshotPrefix); err != nil {
return
}
+1 -26
View File
@@ -4,11 +4,10 @@ import (
"io/ioutil"
"fmt"
yaml "github.com/go-yaml/yaml"
"github.com/go-yaml/yaml"
"github.com/mitchellh/mapstructure"
"github.com/pkg/errors"
"github.com/problame/go-streamrpc"
"github.com/zrepl/zrepl/replication"
"os"
"regexp"
"strconv"
@@ -228,30 +227,6 @@ func parseConnect(i map[string]interface{}) (c streamrpc.Connecter, err error) {
}
func parseInitialReplPolicy(v interface{}, defaultPolicy replication.InitialReplPolicy) (p replication.InitialReplPolicy, err error) {
s, ok := v.(string)
if !ok {
goto err
}
switch {
case s == "":
p = defaultPolicy
case s == "most_recent":
p = replication.InitialReplPolicyMostRecent
case s == "all":
p = replication.InitialReplPolicyAll
default:
goto err
}
return
err:
err = errors.New(fmt.Sprintf("expected InitialReplPolicy, got %#v", v))
return
}
func parsePrunePolicy(v map[string]interface{}, willSeeBookmarks bool) (p PrunePolicy, err error) {
policyName, err := extractStringField(v, "policy", true)
-1
View File
@@ -12,7 +12,6 @@ jobs:
}
snapshot_prefix: zrepl_
interval: 10m
initial_repl_policy: most_recent
# keep one hour of 10m interval snapshots of filesystems matched by
# the left-hand-side of the mapping
-1
View File
@@ -17,7 +17,6 @@ jobs:
mapping: {
"<":"storage/backups/zrepl/pull/prod1.example.com"
}
initial_repl_policy: most_recent
# follow a grandfathering scheme for filesystems on the right-hand-side of the mapping
snapshot_prefix: zrepl_