pub struct Engine { /* private fields */ }Expand description
The engine: answers the value of a cell as of a time. See the crate documentation.
Implementations§
Source§impl Engine
impl Engine
Sourcepub fn builder(
store: Arc<dyn Store + Send + Sync>,
host: impl Into<String>,
) -> EngineBuilder
pub fn builder( store: Arc<dyn Store + Send + Sync>, host: impl Into<String>, ) -> EngineBuilder
A builder for an engine on store, signing as the mesh host.
Sourcepub fn get(
&self,
cell: &CellRef,
asof: Option<&str>,
) -> Result<Answer, EngineError>
pub fn get( &self, cell: &CellRef, asof: Option<&str>, ) -> Result<Answer, EngineError>
The value of the cell cell denotes, as of asof (else cell.asof, else now).
The function name resolves as of the asof; with no binding then, the answer is
Answer::NotCovered. See the crate documentation for the answers and errors.
Sourcepub fn get_cell(
&self,
cell: &Cell,
asof: Option<&str>,
) -> Result<Answer, EngineError>
pub fn get_cell( &self, cell: &Cell, asof: Option<&str>, ) -> Result<Answer, EngineError>
The value of cell (its function pinned by fn_hash), as of asof (else now). The
form for a reference that already carries the function hash. An unknown function
hash is Answer::NotCovered.
Sourcepub fn stored_version_added(&self, cell_id: &str)
pub fn stored_version_added(&self, cell_id: &str)
Tells the engine that a stored version of cell_id was added: the memoised answers
that depend on the cell are dropped.
Sourcepub fn clear_memo(&self)
pub fn clear_memo(&self)
Drops every memoised answer.
Sourcepub fn memo_stats(&self) -> MemoStats
pub fn memo_stats(&self) -> MemoStats
Sizes of the memo and of the dirty set.
Trait Implementations§
Source§impl Resolver for Engine
impl Resolver for Engine
Source§fn evaluate(&self, cell: &Cell, asof: &str) -> Option<Scalar>
fn evaluate(&self, cell: &Cell, asof: &str) -> Option<Scalar>
The value of cell as of asof by the engine’s answering rule (a receipt answers at
A when its tx and its asof are both at or before A): a stored cell’s is looked up; a
computed cell’s function is evaluated (its inputs answered as for get, and stored
when new), never read back from its own receipts. None when there is none or the
evaluation fails (logged with tracing, target datumesh_engine).
Source§fn descriptor(&self, fn_hash: &str) -> Option<Cow<'_, [u8]>>
fn descriptor(&self, fn_hash: &str) -> Option<Cow<'_, [u8]>>
fn_hash, or None if unavailable
(E_FN_UNAVAILABLE). Only None is unavailability: the text is parsed strictly
(unparseable text reports its parse code), and any other JSON value, null included,
is a descriptor offered that fails the hash check (E_FN_HASH_MISMATCH, SPEC 10.1
step 7.1).