mirror of
https://github.com/zrepl/zrepl.git
synced 2024-11-22 08:23:50 +01:00
30cdc1430e
This commit - adds a configuration in which no step holds, replication cursors, etc. are created - removes the send.step_holds.disable_incremental setting - creates a new config option `replication` for active-side jobs - adds the replication.protection.{initial,incremental} settings, each of which can have values - `guarantee_resumability` - `guarantee_incremental` - `guarantee_nothing` (refer to docs/configuration/replication.rst for semantics) The `replication` config from an active side is sent to both endpoint.Sender and endpoint.Receiver for each replication step. Sender and Receiver then act accordingly. For `guarantee_incremental`, we add the new `tentative-replication-cursor` abstraction. The necessity for that abstraction is outlined in https://github.com/zrepl/zrepl/issues/340. fixes https://github.com/zrepl/zrepl/issues/340
49 lines
1.1 KiB
Go
49 lines
1.1 KiB
Go
package snapper
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
"github.com/zrepl/zrepl/config"
|
|
"github.com/zrepl/zrepl/zfs"
|
|
)
|
|
|
|
// FIXME: properly abstract snapshotting:
|
|
// - split up things that trigger snapshotting from the mechanism
|
|
// - timer-based trigger (periodic)
|
|
// - call from control socket (manual)
|
|
// - mixed modes?
|
|
// - support a `zrepl snapshot JOBNAME` subcommand for config.SnapshottingManual
|
|
type PeriodicOrManual struct {
|
|
s *Snapper
|
|
}
|
|
|
|
func (s *PeriodicOrManual) Run(ctx context.Context, wakeUpCommon chan<- struct{}) {
|
|
if s.s != nil {
|
|
s.s.Run(ctx, wakeUpCommon)
|
|
}
|
|
}
|
|
|
|
// Returns nil if manual
|
|
func (s *PeriodicOrManual) Report() *Report {
|
|
if s.s != nil {
|
|
return s.s.Report()
|
|
}
|
|
return nil
|
|
}
|
|
|
|
func FromConfig(g *config.Global, fsf zfs.DatasetFilter, in config.SnapshottingEnum) (*PeriodicOrManual, error) {
|
|
switch v := in.Ret.(type) {
|
|
case *config.SnapshottingPeriodic:
|
|
snapper, err := PeriodicFromConfig(g, fsf, v)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
return &PeriodicOrManual{snapper}, nil
|
|
case *config.SnapshottingManual:
|
|
return &PeriodicOrManual{}, nil
|
|
default:
|
|
return nil, fmt.Errorf("unknown snapshotting type %T", v)
|
|
}
|
|
}
|