Skip to main content

Module replication

Module replication 

Source
Expand description

Replication: every store a node, each file written by one home and copied by the nodes that ask for it, as the nodes guide describes.

A node keeps a log of each file it writes, as the pages each commit wrote, in log/<file>/ of its directory. Another node takes a file from it over a link: a snapshot of its pages first, then each entry as the log grows, applied to a copy its engines read; and it serves what it copies to the nodes that take from it in turn, the same bytes its home wrote.

Structs§

Demoted
A file a demotion made a copy again.
FileStatus
One file of a node as its directory holds it.
Follower
A node taking files from this one.
Links
A running node’s links, as it last wrote them.
Moved
A file a live move made this node’s own.
Node
What makes a store a node: it keeps a log of each file it writes, from which other nodes copy the file, and copies the files of the node it takes from. A draft: the names are the owner’s to settle.
NodeTls
TLS on a node’s links: the certificate its server answers with, and the roots it trusts of the node it takes from. A draft, as its names are.
Promoted
A file a promotion made this node’s own.

Functions§

demote
Makes the files of the stopped store in dir copies again, an old home coming back once another took its place: those named, or every file it writes but its own records and metrics. Each takes a snapshot of its new home once the node starts with from reaching it, and the commits it made that its new home never had are lost.
links
The links of the node running in dir, as it last wrote them; none when no node runs there, or ran and stopped.
move_home
Makes this running node the home of file, which another running node writes and this node holds a whole copy of. A move the catalog already names this node the home of, past its point of no return, is finished. A draft, as its name is.
promote
Makes the copies of the stopped store in dir its own files: those named, or every whole copy it holds when none is. A copy that is not whole, or a name that is no copy, is refused before any changes.
served_by
The files the node at address serves, its own and its whole copies, as its welcome says to the node in dir with node’s token and TLS; none when nothing answers there. A node that refuses the link is an error.
status
Every file the node in dir logs.
verify
Checks this node’s copy of file against the node it takes it from, page for page, at the point that node holds now: the entry checked, or Corrupt when the pages differ.