ingraph 0.1.0

A declaration-driven indexing framework: records and nodes are written as Rust types, and the storage rows, the dataflow between them and the GraphQL query surface are emitted from the declaration.
Documentation
//! [`Grain`] — WHAT a retrieve collapses to, asked at the query rather than declared.

/// The grain a retrieve's dedup collapses at.
///
/// # The axis split it belongs to
///
/// `dedup(hash|eq)` stays DECLARED because it is a bounds choice on the key type — a property of the
/// declaration's own types, which only the declaration knows. The grain is result SHAPING, which
/// only the caller knows: the same index answers *find me the moments* and *find me the videos*
/// depending on what the client is drawing. 声明管界, 查询管形 — the declaration governs the bounds,
/// the query governs the shape.
///
/// # `Root` widens what collapses; it never changes what comes back
///
/// The return type is the same under both, and the surviving items are the node's OWN keys under
/// both. What `Root` changes is which LATECOMERS are dropped: a second hit whose root has already
/// been seen collapses into the first instead of standing beside it. Since the engine's stream is
/// score-descending and first-seen wins, the survivor is the BEST segment of that root — which is
/// the *search videos, show the moment that matched* result with no second query and no second type.
///
/// # A non-lineage node does not get this parameter at all
///
/// The root projection is the key's own root-first prefix, so a node whose key has no ancestry has
/// no prefix to project to, and its emitted face simply has no grain argument. That is compile-time
/// shaping by the emission rather than a runtime refusal — there is no `Grain::Root` call on such a
/// node to refuse.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum Grain {
  /// Collapse at the node's own key — seven matching segments of one video are seven results.
  ///
  /// THE DEFAULT, and the grain every retrievable node can answer at.
  #[default]
  Own,
  /// Collapse at the key's root-first prefix — seven matching segments of one video are one result,
  /// and it is the best of the seven.
  Root,
}

#[cfg(test)]
mod tests;