ressync

package
v3.0.0-rc45 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2026 License: Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	KWMaxDelay = keywords.Keyword{
		Aliases:       []string{"sync_max_delay"},
		Attr:          "MaxDelay",
		Converter:     converters.Duration,
		DefaultOption: "sync_max_delay",
		Option:        "max_delay",
		Text:          keywords.NewText(fs, "text/kw/max_delay"),
	}
	KWSchedule = keywords.Keyword{
		Attr:          "Schedule",
		DefaultOption: "sync_schedule",
		Example:       "00:00-01:00 mon",
		Option:        "schedule",
		Scopable:      true,
		Text:          keywords.NewText(fs, "text/kw/schedule"),
	}

	BaseKeywords = []*keywords.Keyword{
		&KWMaxDelay,
		&KWSchedule,
	}
)

Functions

This section is empty.

Types

type DatasetReplicator

type DatasetReplicator interface {
	RID() string
	ReplicatesDataset(dataset string) bool
	GetMaxDelay(lastSync time.Time) time.Duration
	MaxDelayOrigin() string
}

DatasetReplicator is a sync resource replicating zfs datasets to its peers, as sync.zfs does. It tells the snapshot resources of the object which of their datasets reach the peers, and how fresh the replicas are expected to be.

type Stats

type Stats struct {
	Endpoint      string
	SentBytes     uint64
	ReceivedBytes uint64
	Begin         time.Time
	End           time.Time
}

func NewStats

func NewStats(endpoint string) *Stats

func (*Stats) Close

func (t *Stats) Close()

func (*Stats) Duration

func (t *Stats) Duration() (duration time.Duration)

func (*Stats) SpeedBPS

func (t *Stats) SpeedBPS() (speed float64)

type T

type T struct {
	resource.T
	MaxDelay *time.Duration `json:"max_delay"`
	Schedule string         `json:"schedule"`
	Path     naming.Path    `json:"path"`
}

func (*T) CopyWithStats

func (t *T) CopyWithStats(ctx context.Context, dst io.Writer, src io.Reader, stats *Stats) (uint64, error)

func (*T) GetMaxDelay

func (t *T) GetMaxDelay(lastSync time.Time) time.Duration

GetMaxDelay is how long after lastSync the copy is stale: max_delay when set, or else derived from the schedule, 0 meaning neither is.

func (*T) GetTargetNodenames

func (t *T) GetTargetNodenames(target, nodes, drpNodes []string) []string

func (*T) GetTargetPeernames

func (t *T) GetTargetPeernames(target, nodes, drpNodes []string) []string

func (*T) IsInstanceSufficientlyStarted

func (t *T) IsInstanceSufficientlyStarted(ctx context.Context) (bool, string)

IsInstanceSufficientlyStarted reports whether this node holds the instance the data is replicated from, and why not when it does not. See instance.IsReplicationSource for the rules.

A node where its reference resources are not up is a passive one, which must not send: its copy would replace the one of the active node.

func (*T) MaxDelayOrigin

func (t *T) MaxDelayOrigin() string

MaxDelayOrigin says where GetMaxDelay takes its value from, for the messages to say why a copy is stale.

func (*T) RunDir

func (t *T) RunDir() runfiles.Dir

RunDir holds a file per sync in progress, as the one of a task: the daemon watches it, and marks the resource and its instance running while a file is there.

func (*T) Running

func (t *T) Running() (resource.RunningInfoList, error)

Running implements resource.Runninger: the syncs in progress, from their run files.

func (*T) SelectPeernames

func (t *T) SelectPeernames(target, configured, nodes, drpNodes []string) ([]string, error)

SelectPeernames is the peers a run asked to sync to target reaches, among the peers of configured, the target of the configuration. An empty target asks all of them. A target is "nodes", "drpnodes", "local", or a node selector expression, so a peer that needs syncing on its own is named.

func (*T) StartRun

func (t *T) StartRun() (func(), error)

StartRun records a sync in progress until the func it returns is called.

func (*T) StatusLastSync

func (t *T) StatusLastSync(nodenames []string, receiving bool) status.T

StatusLastSync judges the freshness of the copies of nodenames. receiving says this node is one of them, a node the data is replicated to, whose copy has a recovery point objective: its max delay.

func (*T) WriteLastSync

func (t *T) WriteLastSync(nodename string) error

func (*T) WritePeerLastSync

func (t *T) WritePeerLastSync(ctx context.Context, peer string) error

WritePeerLastSync records that peer was synced now, and sends it the records it reads: its own last sync, which its status tells the freshness of its copy from, the last sync of this node, and the last run of the schedule, which keeps its scheduler from syncing again too soon if it becomes the source.

The records of the other peers are not sent: a node reads them only once it is the source, and its first sync writes them.

Jump to

Keyboard shortcuts

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