add status command

This commit is contained in:
Anton Schirg
2018-08-29 19:18:54 +02:00
parent e495824834
commit 6cedd0a2e8
5 changed files with 277 additions and 4 deletions
+14 -3
View File
@@ -55,7 +55,18 @@ func PushFromConfig(g config.Global, in *config.PushJob) (j *Push, err error) {
func (j *Push) Name() string { return j.name }
func (j *Push) Status() interface{} {
return nil // FIXME
rep := func() *replication.Replication {
j.mtx.Lock()
defer j.mtx.Unlock()
if j.replication == nil {
return nil
}
return j.replication
}()
if rep == nil {
return nil
}
return rep.Report()
}
func (j *Push) Run(ctx context.Context) {
@@ -94,11 +105,11 @@ func (j *Push) do(ctx context.Context) {
receiver := endpoint.NewRemote(client)
j.mtx.Lock()
rep := replication.NewReplication()
j.replication = replication.NewReplication()
j.mtx.Unlock()
ctx = logging.WithSubsystemLoggers(ctx, log)
rep.Drive(ctx, sender, receiver)
j.replication.Drive(ctx, sender, receiver)
// Prune sender
senderPruner := pruner.NewPruner(10*time.Second, sender, sender, j.keepRulesSender) // FIXME constant