logic

package
v0.7.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 25, 2024 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ReplicationConfigFromConfig added in v0.7.4

func ReplicationConfigFromConfig(in *config.Replication) (*pdu.ReplicationConfig, error)

Types

type ConflictResolution added in v0.7.4

type ConflictResolution struct {
	InitialReplication InitialReplicationAutoResolution
}

func ConflictResolutionFromConfig added in v0.7.4

func ConflictResolutionFromConfig(in *config.ConflictResolution) (*ConflictResolution, error)

func (*ConflictResolution) Validate added in v0.7.4

func (c *ConflictResolution) Validate() error

type Endpoint

type Endpoint interface {
	// Does not include placeholder filesystems
	ListFilesystems(ctx context.Context, req *pdu.ListFilesystemReq) (*pdu.ListFilesystemRes, error)
	ListFilesystemVersions(ctx context.Context, req *pdu.ListFilesystemVersionsReq) (*pdu.ListFilesystemVersionsRes, error)
	DestroySnapshots(ctx context.Context, req *pdu.DestroySnapshotsReq) (*pdu.DestroySnapshotsRes, error)
	WaitForConnectivity(ctx context.Context) error
}

Endpoint represents one side of the replication.

An endpoint is either in Sender or Receiver mode, represented by the correspondingly named interfaces defined in this package.

type Filesystem

type Filesystem struct {
	Path string // compat
	// contains filtered or unexported fields
}

func (*Filesystem) EqualToPreviousAttempt

func (f *Filesystem) EqualToPreviousAttempt(other driver.FS) bool

func (*Filesystem) PlanFS

func (f *Filesystem) PlanFS(ctx context.Context, oneStep bool) ([]driver.Step,
	error,
)

func (*Filesystem) ReportInfo

func (f *Filesystem) ReportInfo() *report.FilesystemInfo

type InitialReplicationAutoResolution added in v0.7.4

type InitialReplicationAutoResolution uint32
const (
	InitialReplicationAutoResolutionMostRecent InitialReplicationAutoResolution = 1 << iota
	InitialReplicationAutoResolutionAll
	InitialReplicationAutoResolutionFail
)

func InitialReplicationAutoResolutionFromConfig added in v0.7.4

func InitialReplicationAutoResolutionFromConfig(in string) (InitialReplicationAutoResolution, error)

func InitialReplicationAutoResolutionString added in v0.7.4

func InitialReplicationAutoResolutionString(s string) (InitialReplicationAutoResolution, error)

InitialReplicationAutoResolutionString retrieves an enum value from the enum constants string name. Throws an error if the param is not part of the enum.

func InitialReplicationAutoResolutionValues added in v0.7.4

func InitialReplicationAutoResolutionValues() []InitialReplicationAutoResolution

InitialReplicationAutoResolutionValues returns all values of the enum

func (InitialReplicationAutoResolution) IsAInitialReplicationAutoResolution added in v0.7.4

func (i InitialReplicationAutoResolution) IsAInitialReplicationAutoResolution() bool

IsAInitialReplicationAutoResolution returns "true" if the value is listed in the enum definition. "false" otherwise

func (InitialReplicationAutoResolution) String added in v0.7.4

type Planner

type Planner struct {
	// contains filtered or unexported fields
}

func NewPlanner

func NewPlanner(secsPerState *prometheus.HistogramVec, bytesReplicated *prometheus.CounterVec, sender Sender, receiver Receiver, policy PlannerPolicy) *Planner

caller must ensure policy.Validate() == nil

func (*Planner) Plan

func (p *Planner) Plan(ctx context.Context) ([]driver.FS, error)

func (*Planner) WaitForConnectivity

func (p *Planner) WaitForConnectivity(ctx context.Context) error

type PlannerPolicy added in v0.7.4

type PlannerPolicy struct {
	ConflictResolution        *ConflictResolution    `validate:"required"`
	ReplicationConfig         *pdu.ReplicationConfig `validate:"required"`
	SizeEstimationConcurrency int                    `validate:"gte=1"`
}

func (PlannerPolicy) Validate added in v0.7.4

func (p PlannerPolicy) Validate() error

type Receiver

type Receiver interface {
	Endpoint
	// Receive sends r and sendStream (the latter containing a ZFS send stream)
	// to the parent github.com/dsh2dsh/zrepl/replication.Endpoint.
	Receive(ctx context.Context, req *pdu.ReceiveReq, receive io.ReadCloser) (*pdu.ReceiveRes, error)
}

type Sender

type Sender interface {
	Endpoint
	// If a non-nil io.ReadCloser is returned, it is guaranteed to be closed before
	// any next call to the parent github.com/dsh2dsh/zrepl/replication.Endpoint.
	// If the send request is for dry run the io.ReadCloser will be nil
	Send(ctx context.Context, r *pdu.SendReq) (*pdu.SendRes, io.ReadCloser, error)
	SendDry(ctx context.Context, r *pdu.SendReq) (*pdu.SendRes, error)
	SendCompleted(ctx context.Context, r *pdu.SendCompletedReq) (*pdu.SendCompletedRes, error)
	ReplicationCursor(ctx context.Context, req *pdu.ReplicationCursorReq) (*pdu.ReplicationCursorRes, error)
}

type Step

type Step struct {
	// contains filtered or unexported fields
}

func (*Step) ReportInfo

func (s *Step) ReportInfo() *report.StepInfo

func (*Step) Step

func (s *Step) Step(ctx context.Context) error

func (*Step) String

func (s *Step) String() string

func (*Step) TargetDate

func (s *Step) TargetDate() time.Time

func (*Step) TargetEquals

func (s *Step) TargetEquals(other driver.Step) bool

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL