This commit is contained in:
Christian Schwarz 2024-05-09 13:25:31 +00:00
parent c8afaf83ab
commit beecb4b93d
6 changed files with 9 additions and 10 deletions

View File

@ -93,7 +93,7 @@ type activeMode interface {
SenderReceiver() (logic.Sender, logic.Receiver)
Type() Type
PlannerPolicy() logic.PlannerPolicy
RunPeriodic(ctx context.Context, wakeReplication trigger.Trigger
RunPeriodic(ctx context.Context, wakeReplication *trigger.Manual)
SnapperReport() *snapper.Report
ResetConnectBackoff()
}
@ -135,7 +135,7 @@ func (m *modePush) Type() Type { return TypePush }
func (m *modePush) PlannerPolicy() logic.PlannerPolicy { return *m.plannerPolicy }
func (m *modePush) RunPeriodic(ctx context.Context, trigger trigger.Trigger {
func (m *modePush) RunPeriodic(ctx context.Context, trigger *trigger.Manual) {
m.snapper.Run(ctx, trigger)
}
@ -224,7 +224,7 @@ func (*modePull) Type() Type { return TypePull }
func (m *modePull) PlannerPolicy() logic.PlannerPolicy { return *m.plannerPolicy }
func (m *modePull) RunPeriodic(ctx context.Context, wakeReplication trigger.Trigger {
func (m *modePull) RunPeriodic(ctx context.Context, wakeReplication *trigger.Manual) {
if m.interval.Manual {
GetLogger(ctx).Info("manual pull configured, periodic pull disabled")
// "waiting for wakeups" is printed in common ActiveSide.do
@ -448,7 +448,6 @@ func (j *ActiveSide) Run(ctx context.Context) {
ctx, cancel := context.WithCancel(ctx)
defer cancel()
periodicTrigger := trigger.New("periodic")
periodCtx, endTask := trace.WithTask(ctx, "periodic")
defer endTask()
go j.mode.RunPeriodic(periodCtx, periodicTrigger)

View File

@ -115,7 +115,7 @@ func (j *SnapJob) Run(ctx context.Context) {
go j.snapper.Run(periodicCtx, snapshottingTrigger)
triggers := trigger.Empty()
triggered, endTask := triggers.Spawn(ctx, []trigger.TriggersnapshottingTrigger, wakeupTrigger})
triggered, endTask := triggers.Spawn(ctx, []trigger.Trigger{snapshottingTrigger, wakeupTrigger})
defer endTask()
invocationCount := 0

View File

@ -43,7 +43,7 @@ type Cron struct {
wakeupWhileRunningCount int
}
func (s *Cron) Run(ctx context.Context, snapshotsTaken trigger.Trigger) {
func (s *Cron) Run(ctx context.Context, snapshotsTaken *trigger.Manual) {
for {
now := time.Now()

View File

@ -8,7 +8,7 @@ import (
type manual struct{}
func (s *manual) Run(ctx context.Context, snapshotsTaken trigger.Trigger {
func (s *manual) Run(ctx context.Context, snapshotsTaken *trigger.Manual) {
// nothing to do
}

View File

@ -52,7 +52,7 @@ type periodicArgs struct {
interval time.Duration
fsf zfs.DatasetFilter
planArgs planArgs
snapshotsTaken *trigger.Trigger
snapshotsTaken *trigger.Manual
dryRun bool
}
@ -104,7 +104,7 @@ func (s State) sf() state {
type updater func(u func(*Periodic)) State
type state func(a periodicArgs, u updater) state
func (s *Periodic) Run(ctx context.Context, snapshotsTaken trigger.Trigger {
func (s *Periodic) Run(ctx context.Context, snapshotsTaken *trigger.Manual) {
defer trace.WithSpanFromStackUpdateCtx(&ctx)()
getLogger(ctx).Debug("start")
defer getLogger(ctx).Debug("stop")

View File

@ -18,7 +18,7 @@ const (
)
type Snapper interface {
Run(ctx context.Context, snapshotsTaken trigger.Trigger
Run(ctx context.Context, snapshotsTaken *trigger.Manual)
Report() Report
}