pub struct IndexSlot { /* private fields */ }Expand description
The package index of a store, built when first asked for and kept exact by the store’s own revision.
No borrow is held across a call that could come back in: a question asked while another is being answered (a reader that calls another reader) finds the index it is already holding and uses it.
Implementations§
Source§impl IndexSlot
impl IndexSlot
Sourcepub fn set_partial(&self, partial: bool)
pub fn set_partial(&self, partial: bool)
Say that the store is not the whole package: an ETP connection holds what was fetched and nothing else.
The index is then marked incomplete (PackageIndex::is_complete is
false: the index of a connection is never complete) -
it answers for what was taken, and a caller that needs more asks
the server. It does not change what is indexed: the store’s inventory is
what it is. Sticky: it describes the store, so a rebuild keeps it, until
set_partial(false) is said.
Sourcepub fn revision(&self) -> Option<u64>
pub fn revision(&self) -> Option<u64>
The revision the index is exact for, or None when there is none yet.
Sourcepub fn node_count(&self) -> Option<usize>
pub fn node_count(&self) -> Option<usize>
How many nodes the index holds; None when there is no index.
Sourcepub fn is_complete(&self) -> Option<bool>
pub fn is_complete(&self) -> Option<bool>
Whether the index covers the store’s whole inventory; None when there
is no index.
Sourcepub fn take_disturbed(&self, consumer: Consumer) -> Disturbed
pub fn take_disturbed(&self, consumer: Consumer) -> Disturbed
What the updates of the index disturbed since this consumer last asked -
and forget it. A cache of answers derived from the links asks this
inside IndexSlot::with, once the index is exact for the store, and
drops what it names (color_walks::ColourCache::disturb,
attachments::Cache::disturb).
Sourcepub fn with<R>(&self, store: &EpcStore, f: impl FnOnce(&PackageIndex) -> R) -> R
pub fn with<R>(&self, store: &EpcStore, f: impl FnOnce(&PackageIndex) -> R) -> R
Run f on an index that is exact for store - the invalidation rule
of ADR-0010.
No index: build one, in one call. A pass started by
IndexSlot::step and unfinished: finish it, then check (the store may
have moved since the pass began; the check below re-reads exactly those
objects). Otherwise ask the store what changed since the index’s
revision: nothing, these uuids, or everything.
An ETP store is an EpcStore like another here; see
IndexSlot::set_partial for what it must say about itself.
Sourcepub fn step(&self, store: &EpcStore, n: usize) -> Progress
pub fn step(&self, store: &EpcStore, n: usize) -> Progress
Advance the pass by n objects, and say how far it is - the
worker loops, yielding between two slices, so a mesh or a click is
answered in the middle of a long pass.
Begins a pass when there is no index, or when the store answers
everything changed. When the index exists and only some objects
changed, they are re-read at once (that is object-by-object and cheap)
and the answer is done. The index is installed the moment the last
slice is read; a question asked before then finishes the pass itself
(IndexSlot::with), it never answers from half an index.