mirror of
https://github.com/zrepl/zrepl.git
synced 2025-06-20 09:47:50 +02:00
move replication policy constants to package replication
This commit is contained in:
parent
9b537ec704
commit
54c9dcb7c1
@ -17,7 +17,7 @@ type LocalJob struct {
|
|||||||
Mapping *DatasetMapFilter
|
Mapping *DatasetMapFilter
|
||||||
SnapshotPrefix string
|
SnapshotPrefix string
|
||||||
Interval time.Duration
|
Interval time.Duration
|
||||||
InitialReplPolicy endpoint.InitialReplPolicy
|
InitialReplPolicy replication.InitialReplPolicy
|
||||||
PruneLHS PrunePolicy
|
PruneLHS PrunePolicy
|
||||||
PruneRHS PrunePolicy
|
PruneRHS PrunePolicy
|
||||||
Debug JobDebugSettings
|
Debug JobDebugSettings
|
||||||
@ -60,7 +60,7 @@ func parseLocalJob(c JobParsingContext, name string, i map[string]interface{}) (
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if j.InitialReplPolicy, err = parseInitialReplPolicy(asMap.InitialReplPolicy, endpoint.DEFAULT_INITIAL_REPL_POLICY); err != nil {
|
if j.InitialReplPolicy, err = parseInitialReplPolicy(asMap.InitialReplPolicy, replication.DEFAULT_INITIAL_REPL_POLICY); err != nil {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,7 +24,7 @@ type PullJob struct {
|
|||||||
// constructed from mapping during parsing
|
// constructed from mapping during parsing
|
||||||
pruneFilter *DatasetMapFilter
|
pruneFilter *DatasetMapFilter
|
||||||
SnapshotPrefix string
|
SnapshotPrefix string
|
||||||
InitialReplPolicy endpoint.InitialReplPolicy
|
InitialReplPolicy replication.InitialReplPolicy
|
||||||
Prune PrunePolicy
|
Prune PrunePolicy
|
||||||
Debug JobDebugSettings
|
Debug JobDebugSettings
|
||||||
|
|
||||||
@ -73,7 +73,7 @@ func parsePullJob(c JobParsingContext, name string, i map[string]interface{}) (j
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
j.InitialReplPolicy, err = parseInitialReplPolicy(asMap.InitialReplPolicy, endpoint.DEFAULT_INITIAL_REPL_POLICY)
|
j.InitialReplPolicy, err = parseInitialReplPolicy(asMap.InitialReplPolicy, replication.DEFAULT_INITIAL_REPL_POLICY)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
err = errors.Wrap(err, "cannot parse 'initial_repl_policy'")
|
err = errors.Wrap(err, "cannot parse 'initial_repl_policy'")
|
||||||
return
|
return
|
||||||
|
@ -11,8 +11,8 @@ import (
|
|||||||
"regexp"
|
"regexp"
|
||||||
"strconv"
|
"strconv"
|
||||||
"time"
|
"time"
|
||||||
|
"github.com/zrepl/zrepl/replication"
|
||||||
"github.com/problame/go-streamrpc"
|
"github.com/problame/go-streamrpc"
|
||||||
"github.com/zrepl/zrepl/cmd/endpoint"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var ConfigFileDefaultLocations []string = []string{
|
var ConfigFileDefaultLocations []string = []string{
|
||||||
@ -226,7 +226,7 @@ func parseConnect(i map[string]interface{}) (c streamrpc.Connecter, err error) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func parseInitialReplPolicy(v interface{}, defaultPolicy endpoint.InitialReplPolicy) (p endpoint.InitialReplPolicy, err error) {
|
func parseInitialReplPolicy(v interface{}, defaultPolicy replication.InitialReplPolicy) (p replication.InitialReplPolicy, err error) {
|
||||||
s, ok := v.(string)
|
s, ok := v.(string)
|
||||||
if !ok {
|
if !ok {
|
||||||
goto err
|
goto err
|
||||||
@ -236,9 +236,9 @@ func parseInitialReplPolicy(v interface{}, defaultPolicy endpoint.InitialReplPol
|
|||||||
case s == "":
|
case s == "":
|
||||||
p = defaultPolicy
|
p = defaultPolicy
|
||||||
case s == "most_recent":
|
case s == "most_recent":
|
||||||
p = endpoint.InitialReplPolicyMostRecent
|
p = replication.InitialReplPolicyMostRecent
|
||||||
case s == "all":
|
case s == "all":
|
||||||
p = endpoint.InitialReplPolicyAll
|
p = replication.InitialReplPolicyAll
|
||||||
default:
|
default:
|
||||||
goto err
|
goto err
|
||||||
}
|
}
|
||||||
|
@ -13,17 +13,6 @@ import (
|
|||||||
"github.com/zrepl/zrepl/replication"
|
"github.com/zrepl/zrepl/replication"
|
||||||
)
|
)
|
||||||
|
|
||||||
// FIXME: remove this
|
|
||||||
type InitialReplPolicy string
|
|
||||||
|
|
||||||
const (
|
|
||||||
InitialReplPolicyMostRecent InitialReplPolicy = "most_recent"
|
|
||||||
InitialReplPolicyAll InitialReplPolicy = "all"
|
|
||||||
)
|
|
||||||
|
|
||||||
// FIXME: remove this
|
|
||||||
const DEFAULT_INITIAL_REPL_POLICY = InitialReplPolicyMostRecent
|
|
||||||
|
|
||||||
// Sender implements replication.ReplicationEndpoint for a sending side
|
// Sender implements replication.ReplicationEndpoint for a sending side
|
||||||
type Sender struct {
|
type Sender struct {
|
||||||
FSFilter zfs.DatasetFilter
|
FSFilter zfs.DatasetFilter
|
||||||
|
12
replication/policy.go
Normal file
12
replication/policy.go
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package replication
|
||||||
|
|
||||||
|
// FIXME: Leftovers from previous versions, not used currently
|
||||||
|
type InitialReplPolicy string
|
||||||
|
|
||||||
|
const (
|
||||||
|
InitialReplPolicyMostRecent InitialReplPolicy = "most_recent"
|
||||||
|
InitialReplPolicyAll InitialReplPolicy = "all"
|
||||||
|
)
|
||||||
|
|
||||||
|
const DEFAULT_INITIAL_REPL_POLICY = InitialReplPolicyMostRecent
|
||||||
|
|
Loading…
x
Reference in New Issue
Block a user