Expand description
What a package keeps of itself, layer by layer.
A face - the front end’s session, the command line, Python - holds one
Cache per open store. Every layer is optional and lazy: Cache::off
keeps nothing, and a function that can use a cache takes one rather than
existing twice, so the fast answer and the slow one are the same code
(ADR-0010).
This crate holds what a WebAssembly front end used to keep for itself alone:
| layer | kept | module |
|---|---|---|
index | the package’s links and property sheets, exact for the store’s revision | index |
colours | the colour walks of the objects asked, and the set they read | colours |
attachments | the listings of what is attached to an object | Cache::attachments_of |
§One implementation, a cache that keeps nothing
A layer that is off is not a second code path: the same function runs, over
a slot that is thrown away when the call returns. A question to
Cache::off therefore builds the index it needs and drops it - slower,
never different. tests/ holds the proof: every answer, cache on and cache
off, side by side.
The colours and the attachments are derived from the index (they read
its links, and what its updates disturb is what they drop), so turning
either on turns the index on (Layers::normalised).
§What this crate does not hold yet
Identity is still the uuid and the uri the store gives (ObjKey is not
there yet), and there is no dependency registry (Ledger). The
creation pieces and the section view’s work are still held by
that front end.
The tests of energyml-cache are one binary (one crate, one test
binary, ADR-0016): a new file is a mod line in tests/main.rs, or it does
not run.
Re-exports§
Modules§
- colours
- The colour of an object, one rule for every face - the walks that
a WebAssembly front end used to keep for itself (the inheritance-resolution order), now held by the
Cache. - index
- The package index of a store, built when first asked for and kept exact by the store’s own revision (ADR-0010), moved here from a WebAssembly front end.
Structs§
- Cache
- What a package keeps of itself: one per open store, with the layers it was made with.
- Held
- What a
Cacheholds right now - a count, so that a test can say “nothing” without a clock. - Layers
- Which layers are on. Every one is off by default and turned on by name.