Documentation
¶
Index ¶
- Variables
- type DatasetReplicator
- type Stats
- type T
- func (t *T) CopyWithStats(ctx context.Context, dst io.Writer, src io.Reader, stats *Stats) (uint64, error)
- func (t *T) EnvSkipReason() string
- func (t *T) GetMaxDelay(lastSync time.Time) time.Duration
- func (t *T) GetTargetNodenames(target, nodes, drpNodes []string) []string
- func (t *T) GetTargetPeernames(target, nodes, drpNodes []string) []string
- func (t *T) IsInstanceSufficientlyStarted(ctx context.Context) (bool, string)
- func (t *T) MaxDelayOrigin() string
- func (t *T) PeerEnvRefusal(nodename string) error
- func (t *T) RunDir() runfiles.Dir
- func (t *T) Running() (resource.RunningInfoList, error)
- func (t *T) SelectPeernames(target, configured, nodes, drpNodes []string) ([]string, error)
- func (t *T) StartRun() (func(), error)
- func (t *T) StatusLastSync(nodenames []string, receiving bool) status.T
- func (t *T) WriteLastSync(nodename string) error
- func (t *T) WritePeerLastSync(ctx context.Context, peer string) error
Constants ¶
This section is empty.
Variables ¶
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 T ¶
type T struct {
resource.T
MaxDelay *time.Duration `json:"max_delay"`
Schedule string `json:"schedule"`
Path naming.Path `json:"path"`
// ObjectEnv and NodeEnv are the env of the object and of this
// node, for the drivers whose manifest binds them.
ObjectEnv string `json:"object_env"`
NodeEnv string `json:"node_env"`
}
func (*T) CopyWithStats ¶
func (*T) EnvSkipReason ¶
EnvSkipReason returns why a sync from this node is skipped, or "" when it is not.
A PRD object running on a node that is not PRD, as on a DRP node after a failover, does not sync: its copies on the PRD nodes are the data to fall back to, which a sync from here would overwrite. The other envs sync wherever they run, as in v2.
func (*T) GetMaxDelay ¶
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) GetTargetPeernames ¶
func (*T) IsInstanceSufficientlyStarted ¶
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 ¶
MaxDelayOrigin says where GetMaxDelay takes its value from, for the messages to say why a copy is stale.
func (*T) PeerEnvRefusal ¶
PeerEnvRefusal returns why the peer nodename is not sent the data of the resource, or nil when it is.
A node that is not PRD sends nothing to a PRD node, whatever the env of the object: its data would overwrite the production one there. It completes the rule of EnvSkipReason, which is about the object, with the one about the nodes.
func (*T) RunDir ¶
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 ¶
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) StatusLastSync ¶
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) WritePeerLastSync ¶
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 syncs of this node and of the other peers, and the last run of the schedule, which keeps its scheduler from syncing again too soon if it becomes the source.
The last syncs of the other peers are what a node that becomes the source tells the freshness of their copies from, until its first sync: a copy is as fresh as the last sync it received, whichever node sent it. v2 sent them all too.