[][src]Trait terminus_store::layer::SubjectLookup

pub trait SubjectLookup {
    fn subject(&self) -> u64;
fn predicates(
        &self
    ) -> Box<dyn Iterator<Item = Box<dyn SubjectPredicateLookup>>>;
fn lookup_predicate(
        &self,
        predicate: u64
    ) -> Option<Box<dyn SubjectPredicateLookup>>; fn triples(&self) -> Box<dyn Iterator<Item = IdTriple>> { ... } }

A trait that caches a lookup in a layer by subject.

This is returned by Layer::subjects and Layer::lookup_subject. It stores slices of the relevant data structures to allow quick retrieval of predicate-object pairs when one already knows the subject.

Required methods

fn subject(&self) -> u64

The subject that this lookup is based on

fn predicates(
    &self
) -> Box<dyn Iterator<Item = Box<dyn SubjectPredicateLookup>>>

Returns an iterator over predicate lookups

fn lookup_predicate(
    &self,
    predicate: u64
) -> Option<Box<dyn SubjectPredicateLookup>>

Returns a predicate lookup for the given predicate, or None if no such lookup could be constructed

Note that even when it can be constructed, that doesn't mean there's any underlying triples. Having ancestor layers with additions for a given subject and predicate will cause a lookup to be constructable, but if subsequent layers deleted all these triples, none will be retrievable.

Loading content...

Provided methods

fn triples(&self) -> Box<dyn Iterator<Item = IdTriple>>

Returns an iterator over all triples that can be found by this lookup

Loading content...

Implementors

impl SubjectLookup for GenericSubjectLookup[src]

Loading content...