finish pruner implementation

This commit is contained in:
Christian Schwarz
2018-08-29 19:00:45 +02:00
parent 0de17fd051
commit a2aa8e7bd7
8 changed files with 574 additions and 0 deletions
+15
View File
@@ -11,6 +11,8 @@ import (
"github.com/zrepl/zrepl/endpoint"
"github.com/zrepl/zrepl/replication"
"sync"
"github.com/zrepl/zrepl/daemon/pruner"
"github.com/zrepl/zrepl/pruning"
)
type Push struct {
@@ -18,6 +20,9 @@ type Push struct {
connecter streamrpc.Connecter
fsfilter endpoint.FSFilter
keepRulesSender []pruning.KeepRule
keepRulesReceiver []pruning.KeepRule
mtx sync.Mutex
replication *replication.Replication
}
@@ -83,4 +88,14 @@ func (j *Push) do(ctx context.Context) {
ctx = logging.WithSubsystemLoggers(ctx, log)
rep.Drive(ctx, sender, receiver)
// Prune sender
senderPruner := pruner.NewPruner(sender, receiver, j.keepRulesSender)
senderPruner.Prune(ctx)
// Prune receiver
receiverPruner := pruner.NewPruner(receiver, receiver, j.keepRulesReceiver)
receiverPruner.Prune(ctx)
}