Bucket Store
lnk-bucket-store is the bucket place's driver: an agent's
collections as objects in its bucket, the first encrypted one
lnk bucket connected for it, through lnk bucket's engine. It keeps
every collection, jobs too, and the storage bridge runs it outside every
sandbox (Interface).
Its objects
Every collection is objects under .link/agent/, which a push, a pull
and a clean of its Home never touch, as link_store_contract::store::objects
keeps them over any bucket of versioned objects: each event, lease,
list of tools, job and file an object, each change written only at the
version read.
Versions
An object's version is the SHA-256 of what it holds, and a write that names one reads the object first, under a lock on this machine for the agent's bucket.
Its names
A conversation's name is read back from one spelling only (its escapes in uppercase hex), so two objects can't pass for one conversation.
On one machine at a time
It's safe on one machine at a time only: two machines writing one agent's bucket at once aren't kept apart, as an agent runs on one machine at a time and a move pauses it where it was before it answers where it goes. An agent copied by hand and started on two machines over one bucket isn't kept apart.
Its encryption
Its encryption (rclone's crypt) keeps names and contents unreadable but doesn't bind an object to its name or its time, so whoever can write the bucket can put back an object it held before, an older lease or list of tools among them, though never write one of its own that reads.
A bucket it refuses
A bucket that isn't encrypted is refused, and so is a call for an agent with no bucket, or a name that isn't an agent's ID. The bridge takes each call only as the agent's own.
Memory's index
The segments of memory's index copy, named by their SHA-256, are kept
on this machine too as they're read or written, plain, mode 0600 in
~/.lnk/bucket/segments/, as memory's own cache of the index is: one is
read from there only while what it holds is still its name's hash, else
dropped and fetched again.
Its tests
It's run through link_store_contract::store::check, check_files and
check_narrowing, here and behind the store bridge, as every driver of
one of Link's three places is.