mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-24 17:35:01 +01:00
WIP
This commit is contained in:
parent
c8afaf83ab
commit
beecb4b93d
@ -93,7 +93,7 @@ type activeMode interface {
|
|||||||
SenderReceiver() (logic.Sender, logic.Receiver)
|
SenderReceiver() (logic.Sender, logic.Receiver)
|
||||||
Type() Type
|
Type() Type
|
||||||
PlannerPolicy() logic.PlannerPolicy
|
PlannerPolicy() logic.PlannerPolicy
|
||||||
RunPeriodic(ctx context.Context, wakeReplication trigger.Trigger
|
RunPeriodic(ctx context.Context, wakeReplication *trigger.Manual)
|
||||||
SnapperReport() *snapper.Report
|
SnapperReport() *snapper.Report
|
||||||
ResetConnectBackoff()
|
ResetConnectBackoff()
|
||||||
}
|
}
|
||||||
@ -135,7 +135,7 @@ func (m *modePush) Type() Type { return TypePush }
|
|||||||
|
|
||||||
func (m *modePush) PlannerPolicy() logic.PlannerPolicy { return *m.plannerPolicy }
|
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)
|
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) 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 {
|
if m.interval.Manual {
|
||||||
GetLogger(ctx).Info("manual pull configured, periodic pull disabled")
|
GetLogger(ctx).Info("manual pull configured, periodic pull disabled")
|
||||||
// "waiting for wakeups" is printed in common ActiveSide.do
|
// "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)
|
ctx, cancel := context.WithCancel(ctx)
|
||||||
defer cancel()
|
defer cancel()
|
||||||
|
|
||||||
periodicTrigger := trigger.New("periodic")
|
|
||||||
periodCtx, endTask := trace.WithTask(ctx, "periodic")
|
periodCtx, endTask := trace.WithTask(ctx, "periodic")
|
||||||
defer endTask()
|
defer endTask()
|
||||||
go j.mode.RunPeriodic(periodCtx, periodicTrigger)
|
go j.mode.RunPeriodic(periodCtx, periodicTrigger)
|
||||||
|
@ -115,7 +115,7 @@ func (j *SnapJob) Run(ctx context.Context) {
|
|||||||
go j.snapper.Run(periodicCtx, snapshottingTrigger)
|
go j.snapper.Run(periodicCtx, snapshottingTrigger)
|
||||||
|
|
||||||
triggers := trigger.Empty()
|
triggers := trigger.Empty()
|
||||||
triggered, endTask := triggers.Spawn(ctx, []trigger.TriggersnapshottingTrigger, wakeupTrigger})
|
triggered, endTask := triggers.Spawn(ctx, []trigger.Trigger{snapshottingTrigger, wakeupTrigger})
|
||||||
defer endTask()
|
defer endTask()
|
||||||
|
|
||||||
invocationCount := 0
|
invocationCount := 0
|
||||||
|
@ -43,7 +43,7 @@ type Cron struct {
|
|||||||
wakeupWhileRunningCount int
|
wakeupWhileRunningCount int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *Cron) Run(ctx context.Context, snapshotsTaken trigger.Trigger) {
|
func (s *Cron) Run(ctx context.Context, snapshotsTaken *trigger.Manual) {
|
||||||
|
|
||||||
for {
|
for {
|
||||||
now := time.Now()
|
now := time.Now()
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
|
|
||||||
type manual struct{}
|
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
|
// nothing to do
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ type periodicArgs struct {
|
|||||||
interval time.Duration
|
interval time.Duration
|
||||||
fsf zfs.DatasetFilter
|
fsf zfs.DatasetFilter
|
||||||
planArgs planArgs
|
planArgs planArgs
|
||||||
snapshotsTaken *trigger.Trigger
|
snapshotsTaken *trigger.Manual
|
||||||
dryRun bool
|
dryRun bool
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -104,7 +104,7 @@ func (s State) sf() state {
|
|||||||
type updater func(u func(*Periodic)) State
|
type updater func(u func(*Periodic)) State
|
||||||
type state func(a periodicArgs, u updater) 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)()
|
defer trace.WithSpanFromStackUpdateCtx(&ctx)()
|
||||||
getLogger(ctx).Debug("start")
|
getLogger(ctx).Debug("start")
|
||||||
defer getLogger(ctx).Debug("stop")
|
defer getLogger(ctx).Debug("stop")
|
||||||
|
@ -18,7 +18,7 @@ const (
|
|||||||
)
|
)
|
||||||
|
|
||||||
type Snapper interface {
|
type Snapper interface {
|
||||||
Run(ctx context.Context, snapshotsTaken trigger.Trigger
|
Run(ctx context.Context, snapshotsTaken *trigger.Manual)
|
||||||
Report() Report
|
Report() Report
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user