Expand description
Keeps the fleetโs Global Memory in step (task #12439, section 4.6): the sending half of
memory.global.put, .remove and .list.
One loop, no change observer: every few seconds this machine fingerprints what it holds for the
fleet (backend::memory::fleet::fingerprint) and, for each LAN peer whose last sync had another
fingerprint (or that has not been synced since it appeared, which is how a machine that was
offline catches up), lists what the peer holds and sends what it lacks or has older. Each side
runs the same loop, so what the peer holds newer comes back on its own turn. A peer that is not
reachable, is not proven, or does not have the ops is left alone until a retry time. Nothing is
sent when nothing changed, so the audit trails only carry real work. What each peer answered
(applied, or kept what it had and why) is kept in status for the Memory list, so the writer can
see which entries did not arrive.
Modulesยง
- status ๐
- What the fleet Global Memory sync did, per peer, for the Memory list to show: when each peer was
last synced, how many entries went, why it could not be (a refused list, an unreachable machine),
and which entries the peer answered but did not apply (an ownerโs
machineentry, say). The writer reads this instead of finding out from the peerโs stewards that an entry never arrived.
Structsยง
- Peer ๐
- One machine to sync with: a key that tells it from the others, and the
hostthe send takes. - Synced ๐
- What the last sync of one peer saw.
Enumsยง
- Answered ๐
- How the peer answered one entry:
Appliedwhen it changed what it holds,Skipped(why)when it answered and kept what it had for a reason the writer should hear about,Nothingwhen there was nothing to do (it already holds it, or holds a newer one, which comes back on its own turn).
Constantsยง
- REASON ๐
- RESYNC ๐
- A peer is synced again after this long even if nothing here changed, to heal a lost push.
- RETRY ๐
- A peer that failed is left alone this long.
- SIGNING_
SLACK ๐ - The signed form of params is a little longer than their JSON text.
- TICK ๐
- How often this machine checks whether it has something new for its peers.
Functionsยง
- answered ๐
- blocking ๐
- install ๐
- Start the loop. Does nothing while remote operations are off.
- peer_
key ๐ - What tells one peer from another in the syncโs bookkeeping. Not the discoveryโs
instance_id: on a stable build it is the version (v0.60.35), the same on every machine running it, so peers that share a version shared one record, and a pass that had synced one counted the others as synced too (only one peer in ten minutes got anything). The install and the channel are the machineโs own; an install that does not announce an id is told apart by its name, channel and address. - peers ๐
- signer ๐
- An agent of this machine to sign with: the requests are
slug@machineon both audit trails. - sync_
once ๐ - sync_
peer ๐ - List what
peerholds and send it what it lacks. Returns how many entries and removals the peer applied, and which ones it answered but did not apply (an ownerโsmachineentry, say) with why. An entry the peer takes badly (one too big to send, say) is skipped and counted, not retried now; the peer is retried later only when the list itself failed or a send could not reach it. - sync_
peers ๐ - Sync every peer that is due. Separate from
sync_onceso a test can give it a fake machine. - sync_
peers_ ๐with sync_peers, with the status it reports to given, so a test reads its own.- why_not ๐