Skip to main content

Module founding

Module founding 

Source
Expand description

The founding an app’s record is derived from: what every holder makes of it alike.

An app’s record holds its content alone. Two devices that make the same record before they sync (a person’s vault opened on a phone and a laptop at once) would each make the containers its fields keep their items in, and the items one of them adds first would land in a container the merge leaves behind. So the containers come first, in one change every holder derives from the record’s workspace, kind and id alone (Scope): an actor derived from them makes it at time zero. The store admits that change only as the one it derives itself (structure); the app’s own first values follow as any change of its.

The workspace is part of every derivation. A record’s id can be the same in every workspace (a workspace’s own accounts record), and a change two workspaces both held would be one change in both: a host keeping both would refuse the second, and the hash would link records the workspaces keep apart.

Modules§

split
Bringing together a record whose root containers its devices each made of their own: what a record founded before every holder derived its founding (super::structure) needs once, and what a merge of such records leaves to do.

Structs§

Scope
The record a founding and its steps are derived for: the record id of kind in the workspace workspace. A record is always one workspace’s, so two workspaces holding a record of the same kind and id still derive changes of their own, and the holders within one derive the same.

Functions§

bring_up
Bring the record scope names, the app app‘s, to version, in the one way every holder does: a record made before its founding was derived (two devices’ own root containers) takes the founding and has what its devices made apart brought together (split::merge_split_containers); then the chain of steps up to version (chain) is written where it is not yet, and last the app’s own rewrite of its content from the version the record stood at (crate::evolution::rewrite). Whether this changed anything.
bring_up_resource
bring_up of the record id of the resource type R in workspace, by the containers and version its surface declares and its own migration (#[resource(migrate = ..)]).
chain
The derived founding of the record scope names (structure) followed by the steps that bring it to each version up to version (crate::evolution::step): the chain every holder of a record at version stands on. Each step follows the one before it, the first the founding, so two holders that wrote their own changes meanwhile still make it byte for byte alike.
containers
The containers at the root of surface’s record that its top-level fields keep their items in, by field name: a collection, map, set or outbox in a map, a list in a list, a record of its own in a map: what structure makes.
found
Give the record scope names, the app app‘s, its derived founding when it was made without one (two devices’ own root containers, before every holder derived it), and bring together what its devices made apart (split::merge_split_containers): once, the first part of bring_up, and all a store that reads no type’s version does on opening a record. Whether this changed anything.
migrate
The step that brings the record scope names to version, on the chain chain derives: the one change a store admits under the migration verb for that version, and the one every holder writes.
new_record
A new record id of R in workspace: its derived founding and the steps to R’s version (chain), then R’s first values, left uncommitted for the caller to commit under its own message. Its version comes from the chain alone, as every holder of the record derives it.
of_kind
The containers a record of surface’s kind founds with: its own record’s (containers), as the store reads the kind’s type from the surface. A surface naming its record by its label declares no type of its kind, and an enum of its kind is no record: either founds with none.
structure
The derived founding of the record scope names, whose fields keep their items in the containers named at its root. A kind that keeps none founds with a change that holds nothing: every record has its founding as its first head, so a record nothing was written to yet is kept and read back like any other, and what follows the founding names it as its dependency.