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.
exchange_user_rules
Share user rules through a tracker checkout. Nothing leaves this machine unless the tracker’s .ljos/sync.toml names a scope: then the tracker is fetched, every host’s rules are merged with the local file by id, and this machine’s rules are sealed with age to the scope’s recipients, committed as .ljos/user-rules/<host>.json.age and pushed. A plaintext <host>.json this machine wrote before is removed in the same commit. Plaintext files from other hosts are still read. With no scope, or LJOS_TRACKER_GIT=off in passing, the rules already in the checkout are read and the tracker is not touched. LJOS_TRACKER_GIT=commit commits and pushes nothing. asked is ljos prefer --user --sync, which pushes whatever LJOS_TRACKER_GIT says. budget bounds every git call. A fetch that does not return leaves the local file as it was.
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. A missing age skips the seal and is not an error.
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.
sync_repo_in_passing
sync_repo as the sitting and finish run it: a repository with no scope file is skipped without a word. Sync is opt-in, and a hint on every sitting pointed agents at a remote the person had not asked for. ljos sync by hand still names the missing file.
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.
user_rule_trackers
Tracker checkouts that carry user rules. A guessed working directory is not one: that is the tree the seat was started in, not the repository that travels between machines. LJOS_USER_RULES_SYNC=off names none. In tests the variable has to be set to something other than off before a tracker is read, so an unset shell does not sync the login’s rules.