Module record
Expand description
Records — the unit of state, collaboration and storage: a type, a stable identity and a home workspace. A file’s identity is its file record, which a rename or move keeps, and its path is only where it sits; records reference other records rather than nesting, so “share the book without my notes” is expressible. One document per record is forced, not chosen: an Automerge change graph names its dependencies by hash, so a filtered stream leaves orphaned changes.
Modules§
- bootstrap
- Idempotent construction of initially empty record slots.
- capability
- A root widget that chooses which record its document is, and owns work scoped to that record.
- index
- A workspace’s index of the records it holds. Ownership of the document is the caller’s business. The reference is what grants access: a member reaches only the records the workspace references, and removing one stops future changes but cannot un-share bytes a peer already synced.
- person
- Records an app holds beside the one it shows.
- transfer
- Transfer: the explicit verb that takes a record across a workspace boundary.
- workspace
- Records a workspace holds that every app of that workspace opens beside
its own ([
collab_types::WORKSPACE_RECORDS]): one per kind and workspace, kept by one app, read and changed from any app’s window.
Structs§
- BlobRef
- A content-addressed blob a record depends on: immutable bytes its content is about or embeds (the PDF an annotation set marks up, an image a document shows). Kept in the record’s metadata, so sync, retention and history see which blobs a record keeps alive.
- Record
Checkout - A record named together with its type — what a widget declares it is working on, and what a workspace index holds.
- Record
Id - The stable identity of a record. Encoded by prefix:
file-record:<uuid>(a file, by the durable id its filesystem record carries — seeRecordId::identify_file),file:<absolute path>(a file known only by where it is: a not-yet-written Save As target, or a filesystem that can’t hold the durable id),uuid:<uuid>(minted, for a record with no natural name),tab:<tab id>(a window’s scratch document until a file names it, seeRecordId::for_tab) andderived:<role>@<id>(seeRecordId::derived). - Record
Kind - What kind of thing a record is —
document,annotation-set,book,playlist. App-owned rather than system-registered, so an app can add a kind without coordinating; the cost is no cross-app library view yet (needs a system-owned type registry, not built here). - Record
Opening - A record opening off the frame (
RecordStore::begin_opening), for the window that shows before it. - Record
Owners - Explicit profile-scoped owner registry. Clones share the original registry; weak entries never keep a closed writer alive.
- Record
Ref - One record’s reference to another: annotations → the document they mark up, a duplicate → the record it was copied from.
- Record
Refusal - An action whose change the workspace refused: the record withdrew it, and the app holding the record is told, as it is of an action refused on this device.
- Record
Reservation - The unique construction owner of a not-yet-live record. Drop cancels only this generation.
- Record
Set - The records one app process has open, and which is live. Owns per-record persistence and parking, not collaboration: routing a record’s deltas is the toolkit’s business, since a channel belongs to the connection.
- Record
Store - A
RecordSetseveral widgets share via a handle, so two tabs on the same file stay one document; single-threaded on purpose, since aMutexhere would guard against nothing. - Stored
Record - A record held beside the one an app shows: the app’s own of a kind, one
of the person’s, or one of the workspace’s (
super::workspace), each held the same way. Edits are attributed to the person, recorded as undo steps of their own and synced on the record’s route where it has one.
Enums§
- History
Unavailable - Why a record could not be changed now (
RecordStore::with_history_or_why). - Record
Open Error - Record
Open Outcome - Record
Save Status - Whether a record’s changes are stored.
Constants§
- MAX_
DISCOVERED_ RECORDS - Upper bound for the records an app learns from one workspace index at once: the index is replicated input, not a request to allocate one local document per entry.
- MAX_
FORMER_ IDS - Former identities a checkout may name for migration.
- MAX_
RECORD_ RELATION_ BYTES - The longest relation or label a record reference may carry.
- SURFACE
- The key of the record identity naming the surface its changes are
decided against: the content hash of its app package’s
surface.toml. - WORKSPACE_
ALIAS - The key a record written while the field was named
workspacecarries its workspace under; those documents exist, so it is read where it is (see [stored_workspace]) and never written.
Functions§
- add_
blob_ reference - Record that this record depends on
blob. Idempotent on(hash, relation). Returns whether a reference was added. - add_
reference - Idempotent on
(target, relation): a reference is a fact, not an event. - author_
writer - The actor
author’s mount edits a record as, when the record’s writer isrecord_writerand the host asked for per-author writers; mounts of one profile and device share a document, so this keeps each author’s edits apart. Unique per writer, and the same after a reopen, so history names the same author. - blob_
references - Every blob this record depends on.
- chain_
of_ resource_ id - The chain a resource published under
idis (chain_resource_id), orNonewhenidnames no chain. - chain_
resource_ id - The address the chain
chain(whose parts areRecordId::part) is published under, as one resource beside its app’s own. - children_
resource_ id - The address the child records of
kindthatparentlists are published under, as one container resource beside the app’s own. - former_
identities - Identities this record’s document was known by before adoption, oldest
first (see
RecordCheckout::formerly). - genesis_
actor - The actor that made the genesis of the record
docholds: nobody edits as it, and its changes carry no time, so history lists none of them. - home
- The workspace this record was minted in.
- identity
- The identity stamped into
doc, if it holds a record. - init
- Stamp a document with the identity of the record it holds; idempotent, so a reopen does not author a change graph entry that says nothing new.
- init_
scoped - Bind a record document to
workspace, never rewriting an existing identity or workspace: a document stamped for another workspace would turn a matching record id into an alias across workspaces. A document naming none may be adopted once, after its identity is checked. - references
- Every record this one references.
- tick
- Run one record tick: if the widget tree names a record other than the
live one, park it and check the named one out.
tilo_ui::Appcalls this once per frame, beforesync, so a widget that opened a file last frame is editing that file’s document by the time it next reads state. The checkout it returns is the caller’s cue to re-announce its collaboration channel — a checkout is a change of address. - valid_
label - Whether
valueis a label that can travel in a workspace index or record stamp: at mostmaxbytes of ASCII letters, digits,.,_and-, beginning with a letter. - workspace_
scope - The workspace this local replica is bound to, under either key, absent only for records written
before records were scoped to a workspace; callers may adopt those once with
init_scoped, but must never treat an explicit other workspace as interchangeable.