Expand description
The read kernel: what a page reads from the host (a status’s value, a list’s rows), kept in one place and read away from the UI thread.
Experimental: may change in any release
(docs/stability.md).
- Keyed: a read is a command and its arguments. Two pages asking the same thing share one entry, and one request while it is in flight.
- At once:
ReadKernel::readnever waits. It answers what it holds now with aReadState:Pending(nothing yet),Fresh,Refreshing(the last value, known to be out of date, while a new one is read) orFailed(the last read failed; the value before it, if any, is kept). - Stale while revalidating: a value is never dropped for being old. Out of date, it is shown until the new one comes.
- Policies: the host says, per command, how long a value stays
fresh (
ReadPolicy::fresh_for) and which events make it out of date (ReadPolicy::invalidated_by,nameorprefix.*). A value past its freshness is read again in the background while it is shown, and keeps the stateFreshmeanwhile; one an event made out of date isRefreshing. Without a freshness, a value stays fresh until an event orReadKernel::invalidate_all. - The host contract: the host gives a
ReadTransport, called on a thread of the kernel’s (at once on the web, or when no thread starts). The kernel asks the window to repaint when an answer comes, and when a value shown will be past its freshness.
The Settings app reads through it the commands its transport serves
(crate::admin::Admin::attach_reads); other commands keep being run
on the command bus.
The cache is a map under a lock, not a cache crate: the entries are a
page’s reads (tens, not millions), they are never evicted (a stale
value is what is shown while revalidating), and in-flight sharing
must not block the caller, which the caches surveyed (moka,
quick_cache) do by waiting on the first loader.
Structs§
- Read
- A read’s answer now.
- Read
Kernel - The kernel: the host’s
ReadTransport, the policies and the values read. Shared (Arc); every method takes&self. - Read
Policy - How a command’s reads are kept.
Enums§
- Read
State - Where a read stands.
Traits§
- Read
Transport - What the host reads for the kernel: its node, its database, a service. Called away from the UI thread; may take its time.
Functions§
- matches
- Whether
namematchespattern(name, orprefix.*).