mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-22 23:20:51 +01:00
pruner: single: remove unused member considerSnapAtCursorReplicated
This commit is contained in:
parent
e8c0d206ea
commit
d8d9e34914
@ -82,9 +82,8 @@ type PrunerFactory struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type SinglePrunerFactory struct {
|
type SinglePrunerFactory struct {
|
||||||
keepRules []pruning.KeepRule
|
keepRules []pruning.KeepRule
|
||||||
retryWait time.Duration
|
retryWait time.Duration
|
||||||
considerSnapAtCursorReplicated bool
|
|
||||||
promPruneSecs *prometheus.HistogramVec
|
promPruneSecs *prometheus.HistogramVec
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -106,18 +105,16 @@ func NewSinglePrunerFactory(in config.PruningLocal, promPruneSecs *prometheus.Hi
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, errors.Wrap(err, "cannot build pruning rules")
|
return nil, errors.Wrap(err, "cannot build pruning rules")
|
||||||
}
|
}
|
||||||
considerSnapAtCursorReplicated := false
|
|
||||||
for _, r := range in.Keep {
|
for _, r := range in.Keep {
|
||||||
knr, ok := r.Ret.(*config.PruneKeepNotReplicated)
|
if _, ok := r.Ret.(*config.PruneKeepNotReplicated); ok {
|
||||||
if !ok {
|
// rule NotReplicated for a local pruner doesn't make sense
|
||||||
continue
|
// because no replication happens with that job type
|
||||||
|
return nil, fmt.Errorf("single-site pruner cannot support `not_replicated` keep rule")
|
||||||
}
|
}
|
||||||
considerSnapAtCursorReplicated = considerSnapAtCursorReplicated || !knr.KeepSnapshotAtCursor
|
|
||||||
}
|
}
|
||||||
f := &SinglePrunerFactory{
|
f := &SinglePrunerFactory{
|
||||||
keepRules: rules,
|
keepRules: rules,
|
||||||
retryWait: envconst.Duration("ZREPL_PRUNER_RETRY_INTERVAL", 10 * time.Second),
|
retryWait: envconst.Duration("ZREPL_PRUNER_RETRY_INTERVAL", 10*time.Second),
|
||||||
considerSnapAtCursorReplicated: considerSnapAtCursorReplicated,
|
|
||||||
promPruneSecs: promPruneSecs,
|
promPruneSecs: promPruneSecs,
|
||||||
}
|
}
|
||||||
return f, nil
|
return f, nil
|
||||||
@ -192,7 +189,7 @@ func (f *SinglePrunerFactory) BuildSinglePruner(ctx context.Context, target Targ
|
|||||||
receiver,
|
receiver,
|
||||||
f.keepRules,
|
f.keepRules,
|
||||||
f.retryWait,
|
f.retryWait,
|
||||||
f.considerSnapAtCursorReplicated,
|
false, // considerSnapAtCursorReplicated is not relevant for local pruning
|
||||||
f.promPruneSecs.WithLabelValues("local"),
|
f.promPruneSecs.WithLabelValues("local"),
|
||||||
},
|
},
|
||||||
state: Plan,
|
state: Plan,
|
||||||
|
Loading…
Reference in New Issue
Block a user