Skip to main content

Query

Trait Query 

Source
pub trait Query {
    type Id: Copy + Eq + HashWork;
    type Document: Copy + Eq;
    type Generation: Copy + Eq;
    type Work: Work;

    // Required methods
    fn snapshot(&self) -> Snapshot<Self::Document, Self::Generation>;
    fn execution(&self) -> &Self::Work;
    fn admit(
        &self,
        node: Self::Id,
        units: u64,
    ) -> Result<(), ScopeError<Self::Id>>;

    // Provided method
    fn equal(
        &self,
        left: Self::Id,
        right: Self::Id,
    ) -> Result<bool, MemoryError> { ... }
}
Expand description

One current query over one expected source snapshot.

Every long-term validation check runs under the query that performs it: retained facts are never prepaid work. A format layer implements this over its own access guard, so its checks and these share one admission path; Scope implements it over any Source.

Required Associated Types§

Source

type Id: Copy + Eq + HashWork

Original node identity.

Source

type Document: Copy + Eq

Stable document identity.

Source

type Generation: Copy + Eq

Exact document generation.

Source

type Work: Work

Current execution funding this query.

Required Methods§

Source

fn snapshot(&self) -> Snapshot<Self::Document, Self::Generation>

The expected source snapshot of every fact checked in this query.

Source

fn execution(&self) -> &Self::Work

The current execution; storage and work for results are admitted here.

Source

fn admit(&self, node: Self::Id, units: u64) -> Result<(), ScopeError<Self::Id>>

Requires the live source at the expected snapshot, admits units of work, and requires the snapshot again.

Provided Methods§

Source

fn equal(&self, left: Self::Id, right: Self::Id) -> Result<bool, MemoryError>

Compares two identities after admitting their complete HashWork.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<S: Source, W: Work> Query for Scope<'_, S, W>