Expand description
Cached entities that share their fields between the views holding them.
Every view of an export receives the same patches, and a derived view holds
the entity its source view holds, so most cached copies of one entity have
the same fields. Each view’s frames carry their own _version (see the
projector), which a view’s copy keeps, so the copies differ in that one
field. A SharedEntity keeps every other field behind an Arc that the
copies share, and _version beside it, per copy. A change replaces or
copies the shared fields before it writes (copy-on-write), so it never
reaches another holder’s copy.
The shared fields of an object are themselves shared one top-level field
at a time (see [Fields]): copying them before a write copies a list of
pointers, and the write then copies only the fields it changes. A patch to
one section of a large entity costs that section, not the entity, and the
old version, still held by a derived view or a subscriber, shares every
other section with the new one. Dropping the old version frees only what
the patch replaced.
Structs§
- Shared
Entity - One copy of a cached entity: fields shared with every other copy that has
the same ones, plus this copy’s
_version.
Constants§
- VERSION_
FIELD - The field each view’s copy of an entity stamps with its own frame version.
Traits§
- Entity
Fields - Field access shared by plain values and
SharedEntitycopies.
Functions§
- lookup
- The value at
path, field names from the top ofentity; the whole entity for an empty path.Noneas soon as a step is missing.