Skip to main content

Module protocol

Module protocol 

Source
Expand description

What each mesh protocol changed, and what this node knows of its peers’ versions: the one place that says what is going on when the team runs more than one borg.

  • NOTES: per session protocol (borg-mesh sync.rs ALPN, borg/mesh/<n>), what a member on an older one misses. borg doctor, borg status, the drone notice and the mesh’s announcement all quote it, so it is stated once. Each new protocol adds its line (a borg-mesh test fails without it).
  • <store>/mesh/versions.json: the borg version and agreed protocol of each member’s last completed session, from its hello (PeerVersion). A member older than 0.7 sends none.
  • <store>/mesh/protocols.json: the members whose last session ended at the handshake because they speak a protocol this node does not (Mismatch): nothing syncs with them.
  • The announcement: a tell to the collective, sent by the newer node when a session agreed on an older protocol (borg-mesh sync.rs). Its fixed first words (announcement_head) are how every node recognises that it was sent. Messages are the one log every node since 0.4 syncs, so it reaches the installs this code is not on.

All three files are written by the mesh process, local, never synced.

Structs§

Mismatch
A member’s protocol beside this node’s, both as their ALPN (borg/mesh/<n>), and when it was seen.
PeerVersion
What a member’s node told this one in its last completed session (versions_path).

Constants§

ANNOUNCE_PREFIX
Protocol: what every session protocol’s name starts with (borg/mesh/<n>), and so the announcement’s first words (announcement_head).
CRATES
The crates one release installs, in the order borg update installs them: borg-ai (the borg binary) last, so a borg that reports the new version means the mesh and web beside it are new too (update.rs cargo, as its tarball path renames borg last).
ENGINEER_CHARS
Guard: the longest engineer a version record keeps (an email’s limit, RFC 5321): it is shown to drones and engineers, so a member cannot fill their context through it.
INSTALL_SH
Display: the one-line install for a machine without borg update (scripts/install.sh).
NOTES
Per spoken session protocol, newest first: what a member on an older one misses. Each protocol bump adds its line here (borg-mesh sync.rs test every_spoken_protocol_has_a_note).

Functions§

announced
Whether the collective’s message log at store holds the announcement for protocol.
announcement
The announcement a node on ours sends after a session agreed on theirs: who runs which borg, what members on theirs (or older) miss (missed), and how to update. One line of at most msg.rs V1_TEXT characters, so a 0.4 or 0.5 member (borg/mesh/13) is shown it too.
announcement_head
The announcement’s fixed first words for protocol protocol (module doc): how a node tells that it was sent.
check
What borg doctor says of member key’s version beside this node’s (this, on current): a newer borg (Ok: nothing to do here unless a release has it, update.rs), or an older protocol with what it misses (Warn: that member has to update). None for a member on this node’s footing.
current
The protocol this build speaks: NOTES’ first line (borg-mesh sync.rs ALPN; a test there holds them equal).
forget_mismatch
Drops key’s record: a session with it completed, so it speaks this node’s protocol now.
member
How every view names member key: its engineer when known, else peer <short node>.
mismatches
The members whose protocol differs (protocols_path); empty when none.
missed
The NOTES lines a member on theirs misses next to one on ours: every protocol above theirs up to ours, oldest first.
misses
missed as every view quotes it (borg doctor, borg status, borg top, borg web, the drone notice, the announcement): /<n>: <line>, joined by ; . Empty when nothing is missed.
note
What a member on a protocol older than protocol misses: its NOTES line. It names one protocol’s line for the bump rule (borg-mesh sync.rs every_spoken_protocol_has_a_note, which reads NOTES through it); every view of a member quotes misses, which spans the protocols between two.
note_mismatch
Records that key speaks another protocol (the newest sighting stays).
note_version
Records what member key told this node (the newest session stays), PeerVersion::clean.
number
The number of a protocol name (borg/mesh/<n>).
protocols_path
<store>/mesh/protocols.json, {"<member key>": Mismatch}: the members whose last session ended at the handshake because they speak another session protocol (borg-mesh sync.rs ALPN), so nothing syncs with them. Written by the mesh daemon; borg doctor names each one. A session with the member that completes drops its record, and so does a membership that no longer lists it.
retain_mismatches
Keeps only the records of keys keep still allows (the mesh calls it when the membership it holds changes: a removed or revoked member never completes another session, so nothing else drops it).
retain_versions
Keeps only the version records of keys keep still allows, as retain_mismatches keeps theirs.
runs
What a member runs, as every view says it: borg <version>, or older than 0.7 when its hello named none.
update_commands
The commands an announcement offers, for an install of 0.7 or newer and for an older one.
versions
Each member’s last known version (versions_path), each record PeerVersion::clean (the file may come from an older build); empty when missing or unreadable.
versions_path
<store>/mesh/versions.json, {"<member key>": PeerVersion}. Written by the mesh process after every completed session; a membership that no longer lists a member drops its record.