Your browser sucks, JavaScript disabled! Gunnar's console needs JavaScript and WebAssembly. Git over SSH on port 2222 does not.

nordisk/kleene

crates/kleene-index/src/lib.rs

//! Static indexes over a GraphAr set.
//!
//! A set never changes after it is written, so each index here is built once, kept beside
//! the set (a directory `<set>.kix`) and keyed by the set's root hash: a missing index is
//! built, an index whose hash differs from the set's is dropped and built again. The set
//! stays the truth; an index only answers faster what the set already says.
//!
//! - [`AddrColumn`] / [`AddrLookup`]: address to function, block, line or scope (a
//!   predecessor query) on Ragnar Groot Koerkamp's static search tree (`zoomies-stree`),
//!   and address to call site (an exact query over [`SITE_ADDR`], `site.addr`).
//! - [`Reach`]: "can A reach B" from the strong-component condensation and 2-hop labels;
//!   [`ReverseReach`]: who reaches a target set, one bitset per set.
//! - [`Groups`]: key to ids (trait to implementors, type to impls, signature to
//!   functions).
//! - [`ParentTree`]: the why chain from an entry to a vertex, one step per edge.
//! - [`Nesting`] (is A inside B, two compares) and [`Intervals`] (which ranges cover X).
//! - [`Names`]: name to id, a minimal perfect hash over a string column (after PtrHash),
//!   each hit checked against the stored string.
//! - [`Kinds`]: a bitmap per node kind or label value.
//! - [`Central`]: a split graph's coordinator index from the ones above: the id ranges per
//!   part (an `IdSpace` row each), the part graph's [`Reach`] for pruning, the placement
//!   (part -> machine), the [`Names`]; kept in a [`Store`].
//! - [`save_computed_split`] / [`load_computed_split`]: a computed split
//!   (`kleene_graph::computed_split`) kept in the [`Store`] per edge type and part count,
//!   one byte a node, with what it was made by; refused for another snapshot or node count.
//! - [`Loads`]: parts (or the whole graph) loaded ahead of any query from an
//!   [`EdgeSource`] (or its edges by target, [`Transposed`]) at a snapshot ([`LoadKey`]), each with its graph and indexes
//!   ([`LoadedPart`]), read by `Split::part_only` (only the part's rows); their summaries
//!   build [`Central`]; a later query finds them instead of building them.
//!
//! Queries allocate nothing. [`IndexSet`] opens a set's indexes, building what is missing.
//!
//! [`relations`] hands each index to rules as a kleene-plan relation ([`AddrRel`],
//! [`ReachRel`], [`RangeRel`], [`NameRowsRel`], [`KindsRel`], ...); [`catalog()`] reads an
//! X.gar set as a kleene-plan catalog with the indexes built over it ([`indexed`]).

mod addr;
mod cand;
pub mod catalog;
mod central;
mod computed;
mod error;
mod exec;
mod kinds;
mod loads;
mod names;
mod nest;
mod parents;
mod reach;
pub mod relations;
mod set;
mod store;

pub use addr::{AddrColumn, AddrLookup};
pub use cand::Groups;
pub use catalog::{catalog, indexed};
pub use central::{CENTRAL, Central, CentralTables};
pub use computed::{load_computed_split, save_computed_split};
pub use error::{IndexError, Result};
pub use exec::{CONDENSED_WALK_EDGES, Gatling};
pub use kinds::Kinds;
pub use loads::{EdgeSource, GarEdges, LoadKey, LoadedPart, Loads, Transposed};
pub use names::{NameParts, Names};
pub use nest::{IntervalParts, Intervals, Nesting};
pub use parents::ParentTree;
pub use reach::{Reach, ReverseReach};
pub use relations::{
    AddrMode, AddrRel, GroupRel, IntervalRel, KindsRel, LazyReachRel, NameRowsRel, NestRel,
    ParentRel, RangeRel, ReachRel, ReverseReachRel,
};
pub use set::{IndexSet, KINDS_MAX_BYTES, Rules, SITE_ADDR, Timings};
pub use store::{Store, Stored};

/// The README's example, run as a doctest.
#[cfg(doctest)]
#[doc = include_str!("../README.md")]
struct ReadmeDoctests;