Skip to main content

Module sync

Module sync 

Source
Expand description

Sharing the seat’s memory across machines through the tracker repository that already travels between them.

Each tracker repository names one scope in .ljos/sync.toml: the scope’s name and the age recipients allowed to read it. Every machine writes only its own log, .ljos/atoms/<host>.jsonl.age, sealed to those recipients, so two machines never touch one file and git never has to merge a log. A log carries the machine’s live atoms of that scope without their vectors; the receiving pack encodes them again. An atom’s scope is its scope:NAME entity, else the machine’s default scope.

Import posts every atom of every other machine’s log to this seat’s pack, which answers a text it already holds with the claim it has, so an import twice is an import once. Retirement travels by difference: the texts an import took from a host are remembered, and a text that host no longer sends retires the local copy that came from it, never a claim this machine wrote itself.

Structs§

Incoming
What one host’s log asks of this pack: the atoms to post, and the texts it sent last time and sends no longer.
Scope
The scope a tracker repository shares: .ljos/sync.toml.

Functions§

atom_scope
The scope an atom belongs to: its scope:NAME entity, else default.
export
Write this machine’s log for the repository’s scope when its atoms changed since the last write. Returns the line that says what happened.
host
This machine’s short host name.
identity_path
This machine’s age identity, made on first use.
import
Import every other machine’s log of the repository’s scope into this seat’s pack. Returns one line per host.
incoming
Read one host’s log against the texts taken from it last time (before, for what it retired) and the texts from it this pack already holds (held, which are not posted again).
is_own
Whether this machine holds an atom as its own rather than as an import.
log_plaintext
The plaintext of this machine’s log for a scope: its own live atoms of that scope, sorted by id, one JSON object a line.
public_key
The public key of this machine’s identity, making the identity first when there is none. This is what goes into a scope’s recipients.
scope_for_issue
The scope of the repository that holds an issue, when it declares one.
scope_of_repo
The scope a tracker repository declares, when it declares one.
sender_entity
The entity an imported atom carries: which machine sent it.
sync_repo
One pass over the tracker repository’s scope: pull, take every other machine’s log, write and push this machine’s. pull_import and export pick the halves; the sitting takes the first, finish the second.
travelling
An atom as it travels: without its vector, and without a sender tag of another machine, since a host sends only what it holds as its own.