Skip to main content

Cache

Struct Cache 

Source
pub struct Cache { /* private fields */ }
Expand description

What a package keeps of itself: one per open store, with the layers it was made with.

Methods take &self - a face’s methods do, and wasm is single-threaded - and no borrow is held across a call that could come back in: a question asked while another is being answered finds the slot held and answers from one of its own, as IndexSlot::with does.

Implementations§

Source§

impl Cache

Source

pub fn ladders( &self, store: &EpcStore, rows: &[Row<'_>], ) -> Result<Option<Vec<Ladder>>, Error>

The ladders of rows, in order, from the walks the cache keeps: one walker for all of them, the walk of an object done once, a target the tiers already read does not answer resuming it. None when the package holds no GraphicalInformationSet - the caller answers null per row.

Source

pub fn file_colours_at( &self, store: &EpcStore, names: &[String], ) -> Result<HashMap<String, Option<String>>, Error>

The colour the file gives each object names name, as the 3D view’s ladder decides it (a constant colour, #rrggbbaa, or None when no rung answers or the answer is a map), keyed by the object’s full uri (the name itself for an object the package does not hold). One walker for the lot, from the walks the cache keeps: what the section view asks instead of walking again.

A name that fits two versions is refused by name. What each version answers is bounded by the walk beneath, which compares uuids: the answers are two, one per uri, and they agree until the domain’s walk is keyed by identity too.

Source

pub fn file_colours( &self, store: &EpcStore, uuids: &[String], ) -> Result<HashMap<String, Option<String>>, Error>

Cache::file_colours_at for the callers that hold a bare uuid: the answer is keyed by the lowercase uuid asked. A uuid the package holds in two versions is refused by name; ask by uri.

Source

pub fn decision( &self, store: &EpcStore, set: &GraphicalSet, representation: &str, property: Option<&str>, chain: &[String], options: &Options, ) -> Result<Option<Decision>, Error>

The colour rule, once: what one object - or one property of it - inherits, by the inheritance-resolution order: the object, its collections, its parents and theirs, then the model; for a property, its kind and the kind’s parents and nothing beyond. The answer carries its level; the notes of the walk join the decision’s. None means no level answered - an answer, not a failure: the standard defines no default colour.

representation is a uuid - an entry’s target is one, and the walk up to the interpretation and the feature yields them; passing the uri (which the front end once did) meant a colour set on the representation itself was never found. A caller that holds the uri asks Cache::decision_at, which turns it into that key. chain is the property’s kind chain (kind_chain). set is read by the caller, once, for many questions (graphical_set).

Source

pub fn decision_at( &self, store: &EpcStore, set: &GraphicalSet, name: &str, property: Option<&str>, chain: &[String], options: &Options, ) -> Result<Option<Decision>, Error>

Cache::decision for the object name names: its full uri (a short uri or a bare uuid are adapters, refused by name when they fit two versions). The one place a uri becomes the walk’s key.

Source

pub fn colour_walk_stats(&self) -> Stats

What the colour walks did so far - walks begun and dropped, tiers read, objects read. Work, not time: what a test asserts to say a walk was not done twice, and what an invalidation cost.

Source§

impl Cache

Source

pub fn off() -> Self

A cache that keeps nothing: every lookup is a branch, every answer is computed from the store.

Source

pub fn new(layers: Layers) -> Self

A cache with these layers on (see Layers::normalised).

Source

pub fn layers(&self) -> Layers

Which layers are on.

Source

pub fn held(&self) -> Held

What is held now.

Source

pub fn with_index<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 (see index). With the index layer off, the index is built for this call and dropped after it.

Source

pub fn index_step(&self, store: &EpcStore, n: usize) -> Progress

Advance the index’s build by n objects, and say how far it is. A cache whose index layer is off builds nothing between questions and answers nothing to do.

Source

pub fn set_partial(&self, partial: bool)

Say that the store is not the whole package - see IndexSlot::set_partial.

Source

pub fn attachments_of(&self, store: &EpcStore, uuids: &[&str]) -> Vec<Listing>

The listing of what is attached to each of uuids, in order.

Why the listing cache is held from energyml-domain, not moved: what a listing reads, and what drops it, is the domain’s algorithm (attachments::Cache and its own tests); this crate decides only whether a cache is kept between questions, and which account of the index’s disturbances it reads. With the layer off the cache is a fresh one, dropped after the call.

Source

pub fn attachment_stats(&self) -> CacheStats

What the listing cache did so far - listings built and dropped, files read. Work, not time.

Auto Trait Implementations§

§

impl !Freeze for Cache

§

impl !RefUnwindSafe for Cache

§

impl !Sync for Cache

§

impl Send for Cache

§

impl Unpin for Cache

§

impl UnsafeUnpin for Cache

§

impl UnwindSafe for Cache

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more