mirror of
https://github.com/zrepl/zrepl.git
synced 2024-12-21 22:51:09 +01:00
WIP
This commit is contained in:
parent
c8afaf83ab
commit
beecb4b93d
@ -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)
|
||||
|
@ -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
|
||||
|
@ -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()
|
||||
|
@ -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
|
||||
}
|
||||
|
||||
|
@ -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")
|
||||
|
@ -18,7 +18,7 @@ const (
|
||||
)
|
||||
|
||||
type Snapper interface {
|
||||
Run(ctx context.Context, snapshotsTaken trigger.Trigger
|
||||
Run(ctx context.Context, snapshotsTaken *trigger.Manual)
|
||||
Report() Report
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user