Skip to main content

GraphIndex

Struct GraphIndex 

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

The six tiled permutation sections, queryable by triple pattern.

Implementations§

Source§

impl GraphIndex

Source

pub fn from_tiles(sections: [Vec<(u32, u32, Vec<u8>)>; 6]) -> GraphIndex

Rebuild from tiled sections: per permutation, (min_a, max_a, block bytes) per tile in ascending leading-id order — the v0.2 layout.

Source

pub fn from_remote_directories( directories: [Vec<(u32, u32, Option<(u32, u32, u32, u32)>)>; 6], loader: Box<dyn Fn(usize, usize) -> Option<Vec<u8>> + Send + Sync>, ) -> GraphIndex

A remote index: only the tile directories (leading-id ranges per permutation, ascending) are known; tile payloads fault in through loader on first scan. Check load_incomplete after evaluating — a failed fetch must become an error, never a silently smaller result.

Source

pub fn with_bulk_loader( self, bulk: Box<dyn Fn(usize, &[usize]) -> Option<Vec<Vec<u8>>> + Send + Sync>, ) -> GraphIndex

Attach a batched tile fetcher (see [TileBulkLoader]): multi-tile scans prefetch their span through it instead of faulting tile by tile.

Source

pub fn load_incomplete(&self) -> bool

Did any tile fetch fail since this index was opened — or since the last reset_load_failure?

Source

pub fn reset_load_failure(&self)

Forget recorded fetch failures — the start-of-evaluation reset for a RESIDENT session, making the incompleteness verdict per-query instead of per-open (one transient network blip used to fail every later query on the session). Safe because failed tiles are never cached: the next scan simply retries them.

Source

pub fn is_remote(&self) -> bool

True for a remote/lazy index (tiles fault in over a RangeReader). The join planner uses this to pick read-aware strategies: here a per-row index probe is a network round-trip, not a memory lookup, so a left-deep scan + hash join often beats probing a moderately-sized prefix.

Source

pub fn triple_count(&self) -> u32

Total triple count (sum of the SPO tiles’ zone counts). For a remote index this faults in the SPO tiles — prefer the header’s quad count.

Source

pub fn tile_sections(&self) -> [&[Tile]; 6]

The tiles of each permutation section (in ALL_PERMS order), for the file writer.

Source

pub fn best_permutation( pattern: (Option<u32>, Option<u32>, Option<u32>), ) -> IndexPermutation

The permutation selected for a pattern: the one with the longest bound prefix. Ties keep the canonical SPO order (then POS, then OSP), which makes provenance stable for unbound or equally selective shapes and routes a fully unbound pattern to the SPO block rather than fetching all three.

Source

pub fn permutation_sorted_on( pattern: (Option<u32>, Option<u32>, Option<u32>), sort_col: usize, ) -> Option<IndexPermutation>

Choose a permutation that routes on pattern’s bound prefix and streams sorted on the canonical column sort_col (0=subject, 1=predicate, 2=object) — i.e. sort_col is the leading free component after the bound prefix. Returns None if sort_col is itself bound (then every row shares that value — any permutation is “sorted” on it) or no permutation qualifies. This is the precondition a merge join needs: both inputs sorted on the join key. Among qualifiers, the longest bound prefix (best routing) wins.

Source

pub fn match_serialized_block( bytes: &[u8], permutation: IndexPermutation, pattern: (Option<u32>, Option<u32>, Option<u32>), ) -> Vec<(u32, u32, u32)>

Match one already-decoded serialized permutation block (a single v0.1 section or one v0.2 tile). This is the core primitive for range-routed readers: the caller fetches only the selected payload, then this scans it as if it came from a full GraphIndex.

Source

pub fn match_pattern( &self, pattern: (Option<u32>, Option<u32>, Option<u32>), ) -> Vec<(u32, u32, u32)>

All triples matching pattern, returned in canonical (s, p, o) order.

Thin eager wrapper over scan_iter: collect the lazy stream and restore the canonical sort (the stream is sorted in the chosen permutation’s order, which differs from canonical once perm.back permutes the free components).

Source

pub fn scan_iter( &self, pattern: (Option<u32>, Option<u32>, Option<u32>), ) -> impl Iterator<Item = (u32, u32, u32)>

Lazily stream the triples matching pattern in canonical (s, p, o) order within the chosen permutation — the streaming entry point for callers that can stop early (ASK, LIMIT, BGP probes) or that don’t need the canonical re-sort. Decodes only the matching groups (see TripleBlock::scan); a malformed/absent block yields nothing rather than panicking. The permutation is chosen for the longest bound prefix.

Auto Trait Implementations§

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
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<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V