pub struct RocksDbStorage { /* private fields */ }Expand description
RocksDB-backed hexastore storage for one partition axis.
Implementations§
Source§impl RocksDbStorage
impl RocksDbStorage
Sourcepub fn open(path: &Path, axis: PartitionAxis) -> Result<Self, StorageError>
pub fn open(path: &Path, axis: PartitionAxis) -> Result<Self, StorageError>
Open a RocksDB instance at path with axis-local column families.
Sourcepub fn open_with_hooks(
path: &Path,
axis: PartitionAxis,
hooks: RocksDbOptionsHooks<'_>,
) -> Result<Self, StorageError>
pub fn open_with_hooks( path: &Path, axis: PartitionAxis, hooks: RocksDbOptionsHooks<'_>, ) -> Result<Self, StorageError>
Open with optional DB/CF options hooks (stats collectors, listeners).
Sourcepub fn axis(&self) -> PartitionAxis
pub fn axis(&self) -> PartitionAxis
Partition axis this store owns.
Sourcepub fn insert_quad_version(
&self,
quad: &Quad,
commit_ts: CommitTs,
op: StorageOp,
visibility: VisibilityLabel,
) -> Result<(), StorageError>
pub fn insert_quad_version( &self, quad: &Quad, commit_ts: CommitTs, op: StorageOp, visibility: VisibilityLabel, ) -> Result<(), StorageError>
Insert a versioned hexastore record (Put or Delete).
Sourcepub fn insert_encoded_quad_version(
&self,
encoded: &EncodedQuad,
commit_ts: CommitTs,
op: StorageOp,
visibility: VisibilityLabel,
) -> Result<(), StorageError>
pub fn insert_encoded_quad_version( &self, encoded: &EncodedQuad, commit_ts: CommitTs, op: StorageOp, visibility: VisibilityLabel, ) -> Result<(), StorageError>
Insert an already-encoded quad version (partition-service write path).
Sourcepub fn apply_prepared_puts(
&self,
puts: &[HexastorePut],
) -> Result<(), StorageError>
pub fn apply_prepared_puts( &self, puts: &[HexastorePut], ) -> Result<(), StorageError>
Apply pre-encoded index puts as one RocksDB WriteBatch.
Empty puts is a no-op. Caller encodes keys via crate::prepare_hexastore_puts.
Does not update the named-graph catalog; use
Self::apply_prepared_puts_with_catalog on the S-axis write path.
Sourcepub fn apply_prepared_puts_with_catalog(
&self,
puts: &[HexastorePut],
catalog: &[CatalogPut],
) -> Result<(), StorageError>
pub fn apply_prepared_puts_with_catalog( &self, puts: &[HexastorePut], catalog: &[CatalogPut], ) -> Result<(), StorageError>
Apply hexastore index puts and catalog puts in the same WriteBatch.
Empty puts and empty catalog is a no-op. Catalog puts require the S axis.
Sourcepub fn catalog_puts_for_insert(
&self,
graphs: &[(EncodedTerm, CommitTs)],
) -> Result<Vec<CatalogPut>, StorageError>
pub fn catalog_puts_for_insert( &self, graphs: &[(EncodedTerm, CommitTs)], ) -> Result<Vec<CatalogPut>, StorageError>
Prefix-seek the catalog for each graph and stage Present when missing or Dropped.
Sourcepub fn add_named_graph(
&self,
graph: &EncodedTerm,
commit_ts: CommitTs,
) -> Result<(), StorageError>
pub fn add_named_graph( &self, graph: &EncodedTerm, commit_ts: CommitTs, ) -> Result<(), StorageError>
Insert an empty named graph (or recreate after Dropped) at commit_ts.
Sourcepub fn list_named_graphs(
&self,
snapshot: SnapshotId,
) -> Result<Vec<EncodedTerm>, StorageError>
pub fn list_named_graphs( &self, snapshot: SnapshotId, ) -> Result<Vec<EncodedTerm>, StorageError>
Named graphs whose newest in-snapshot catalog version is Present.
Includes empty graphs. Never includes the RDF default graph.
Sourcepub fn rebuild_named_graph_catalog(
&self,
) -> Result<CatalogRebuildStats, StorageError>
pub fn rebuild_named_graph_catalog( &self, ) -> Result<CatalogRebuildStats, StorageError>
Rebuild named_graphs_catalog from all SPOG versions (S axis only).
For each named graph, records the earliest Put commit_ts. Prefix-seeks
the catalog and writes Present only when the prefix is empty — never
clobbers an existing Present or Dropped version.
Sourcepub fn visit_index_versions(
&self,
permutation: IndexPermutation,
visit: impl FnMut(&EncodedQuad, CommitTs, StorageOp) -> Result<(), StorageError>,
) -> Result<(), StorageError>
pub fn visit_index_versions( &self, permutation: IndexPermutation, visit: impl FnMut(&EncodedQuad, CommitTs, StorageOp) -> Result<(), StorageError>, ) -> Result<(), StorageError>
Walk every versioned key in an axis-local index (no MVCC collapse).
Sourcepub fn scan_pattern(
&self,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
) -> Result<Vec<EncodedQuad>, StorageError>
pub fn scan_pattern( &self, pattern: &EncodedTriplePattern, snapshot: SnapshotId, ) -> Result<Vec<EncodedQuad>, StorageError>
Prefix/range scan returning encoded quads visible at snapshot.
For each logical quad, takes the newest version with commit_ts <= snapshot
and includes it only if op == Put. Visibility is not enforced yet.
Sourcepub fn scan_pattern_in(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
) -> Result<Vec<EncodedQuad>, StorageError>
pub fn scan_pattern_in( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, ) -> Result<Vec<EncodedQuad>, StorageError>
Scan pattern through an explicitly chosen axis-local column family.
Returns StorageError::PermutationNotOwned when permutation belongs
to another partition axis.
Sourcepub fn scan_pattern_page(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
start_after: Option<&EncodedQuad>,
graph_filter: GByteFilter,
merge_default_graph: bool,
iri_only: IriOnlyMask,
) -> Result<ScanPage, StorageError>
pub fn scan_pattern_page( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, start_after: Option<&EncodedQuad>, graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, ) -> Result<ScanPage, StorageError>
Prefix scan with the full matcher semantics: residual graph_filter
membership, merge_default_graph whole-triple collapse (rows return with G
rewritten to DefaultGraph), the exclusive start_after cursor, and
iri_only segment pushdown all run inside the RowMatcher on raw key
bytes. limit counts post-filter matches (0 = unlimited) — one
continuous walk, no decoded pre-filter chunking.
Sourcepub fn scan_pattern_page_with_comparisons(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
start_after: Option<&EncodedQuad>,
graph_filter: GByteFilter,
merge_default_graph: bool,
iri_only: IriOnlyMask,
mask: &ComparisonMask,
) -> Result<ScanPage, StorageError>
pub fn scan_pattern_page_with_comparisons( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, start_after: Option<&EncodedQuad>, graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, mask: &ComparisonMask, ) -> Result<ScanPage, StorageError>
Self::scan_pattern_page with compiled slot comparisons applied
inside the walk, before a row reaches the page.
Sourcepub fn count_pattern_impl(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
graph_filter: GByteFilter,
merge_default_graph: bool,
) -> Result<u64, StorageError>
pub fn count_pattern_impl( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, graph_filter: GByteFilter, merge_default_graph: bool, ) -> Result<u64, StorageError>
Count matching rows with the full matcher semantics — same
graph_filter / merge_default_graph / cursor / iri_only contract as
Self::scan_pattern_page, counting raw KeyRows without
decoding any term. limit counts post-filter matches (0 = unlimited).
Execution mode resolves once per process from WARATAH_COUNT_WALKS
(see [count_walk_mode]). Eligible shapes slice the walk across
scoped threads and sum the per-slice counts — identical results by
construction (slices are key-disjoint, and the version-group straddle
skip keeps every MVCC group decision with the slice holding the
group’s newest version). Limited counts (limit > 0) and shapes
without a usable slice plan stay serial: parallel workers cannot
honor a global early-stop budget without coordination, and a limited
count is an existence-style check where the serial early exit is
already cheap.
Sourcepub fn count_pattern_impl_with_class_totals(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
graph_filter: GByteFilter,
merge_default_graph: bool,
class_totals: &[(StrHash, u64)],
force_serial: bool,
) -> Result<u64, StorageError>
pub fn count_pattern_impl_with_class_totals( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, graph_filter: GByteFilter, merge_default_graph: bool, class_totals: &[(StrHash, u64)], force_serial: bool, ) -> Result<u64, StorageError>
Self::count_pattern_impl with advisory TSG class totals — the
partition’s local class_counts profile map in ascending StrHash
order. Only the TSG full-axis shape consumes the hint, cutting the
walk at class boundaries with balanced row shares; every other shape
and every thin/stale hint degrades to byte-even slicing. The hint is
advisory in the ARCH.md §10 sense: a wrong estimate picks a wrong
slice layout, never a wrong answer. force_serial (the partition
dispatch gate’s on-caller path: a µs-scale count must not pay the
worker-pool wake) overrides WARATAH_COUNT_WALKS for this call.
Sourcepub fn count_pattern_best_permutation(
&self,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
) -> Result<u64, StorageError>
pub fn count_pattern_best_permutation( &self, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, ) -> Result<u64, StorageError>
Count matching quads visible at snapshot without collecting rows.
limit of 0 is unlimited; a positive limit stops the iterator once
that many matches have been counted.
Sourcepub fn count_pattern_in(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
) -> Result<u64, StorageError>
pub fn count_pattern_in( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, ) -> Result<u64, StorageError>
Count pattern through an explicitly chosen axis-local column family.
Returns StorageError::PermutationNotOwned when permutation belongs
to another partition axis. limit of 0 is unlimited.
Sourcepub fn scan_pattern_page_allow_list(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
start_after: Option<&EncodedQuad>,
allow_list_slot: QuadSlot,
allow_terms: &[EncodedTerm],
graph_filter: GByteFilter,
merge_default_graph: bool,
iri_only: IriOnlyMask,
) -> Result<Option<ScanPage>, StorageError>
pub fn scan_pattern_page_allow_list( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, start_after: Option<&EncodedQuad>, allow_list_slot: QuadSlot, allow_terms: &[EncodedTerm], graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, ) -> Result<Option<ScanPage>, StorageError>
Allow-list prefix scan with the full matcher semantics per tight
prefix: residual graph_filter membership and merge_default_graph
collapse (rows return with G rewritten to DefaultGraph) run inside
each prefix’s RowMatcher. limit counts post-filter matches
(0 = unlimited). Returns None when slot does not extend
permutation
Sourcepub fn scan_pattern_page_allow_list_with_comparisons(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
start_after: Option<&EncodedQuad>,
allow_list_slot: QuadSlot,
allow_terms: &[EncodedTerm],
graph_filter: GByteFilter,
merge_default_graph: bool,
iri_only: IriOnlyMask,
mask: &ComparisonMask,
) -> Result<Option<ScanPage>, StorageError>
pub fn scan_pattern_page_allow_list_with_comparisons( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, start_after: Option<&EncodedQuad>, allow_list_slot: QuadSlot, allow_terms: &[EncodedTerm], graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, mask: &ComparisonMask, ) -> Result<Option<ScanPage>, StorageError>
Self::scan_pattern_page_allow_list with compiled slot comparisons
applied inside each tight prefix’s walk.
Sourcepub fn scan_domain(
&self,
permutation: IndexPermutation,
constraints: &[EncodedTerm],
snapshot: SnapshotId,
limit: u64,
start_after_constraint: Option<&EncodedTerm>,
start_after_term: Option<&EncodedTerm>,
graph_name: Option<&EncodedTerm>,
graph_filter_terms: &[EncodedTerm],
graph_filter_allow: bool,
iri_only_head: bool,
) -> Result<Vec<DomainScanHit>, StorageError>
pub fn scan_domain( &self, permutation: IndexPermutation, constraints: &[EncodedTerm], snapshot: SnapshotId, limit: u64, start_after_constraint: Option<&EncodedTerm>, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, iri_only_head: bool, ) -> Result<Vec<DomainScanHit>, StorageError>
Domain scan: distinct slot-1 head terms under each slot-0 constraint
on permutation (POSG predicates→objects, SPOG subjects→predicates,
SOPG subjects→objects, OPSG objects→predicates). Axis-local only.
After a visible Put (path 2: whose G is allowed), Seek past the rest of
that head term. A Delete only retires that logical quad; keep walking
this head. limit counts emitted pairs (0 = unlimited).
iri_only_head rejects non-NamedNode heads (FILTER(isIRI) pushdown).
Execution mode resolves once per process from WARATAH_DOMAIN_WALKS
(see [domain_scan_mode]). Every mode
visits constraints in key order (build_walk_constraints) and
emits in that order regardless of caller order: with limit > 0 all
modes truncate the key-first hits, and start_after_* pagination is
key-order coherent (constraints sorting before the cursor constraint
were fully emitted before it, so the resume skip loses nothing).
Sourcepub fn scan_domain_counts(
&self,
permutation: IndexPermutation,
constraints: &[EncodedTerm],
snapshot: SnapshotId,
limit: u64,
start_after_constraint: Option<&EncodedTerm>,
start_after_term: Option<&EncodedTerm>,
graph_name: Option<&EncodedTerm>,
graph_filter_terms: &[EncodedTerm],
graph_filter_allow: bool,
iri_only_head: bool,
merge_default_graph: bool,
mode: DomainCountMode,
) -> Result<Vec<DomainScanCountHit>, StorageError>
pub fn scan_domain_counts( &self, permutation: IndexPermutation, constraints: &[EncodedTerm], snapshot: SnapshotId, limit: u64, start_after_constraint: Option<&EncodedTerm>, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, iri_only_head: bool, merge_default_graph: bool, mode: DomainCountMode, ) -> Result<Vec<DomainScanCountHit>, StorageError>
Domain count scan: run lengths of slot-1 head terms under each
slot-0 constraint on permutation. Axis-local only. Twin of
Self::scan_domain — same visibility semantics (per-logical-quad
MVCC collapse, op == Put, graph window, iri_only_head), but the
walk iterates every key of the constraint prefix instead of seeking
past runs. What one increment represents is mode — see
DomainCountMode. With merge_default_graph set the walk seeks
past extra G per counted triple, which makes Rows coincide with
DistinctTerms. Runs with zero visible rows are not emitted.
limit counts emitted triples (0 = unlimited).
Execution mode resolves once per process from WARATAH_DOMAIN_WALKS
(see [domain_scan_mode]) — the same
switches and emission-order contract as Self::scan_domain.
Sourcepub fn scan_axis_head(
&self,
permutation: IndexPermutation,
snapshot: SnapshotId,
limit: u64,
start_after_term: Option<&EncodedTerm>,
graph_name: Option<&EncodedTerm>,
graph_filter_terms: &[EncodedTerm],
graph_filter_allow: bool,
iri_only_head: bool,
head_prefixes: &[Vec<u8>],
) -> Result<Vec<EncodedTerm>, StorageError>
pub fn scan_axis_head( &self, permutation: IndexPermutation, snapshot: SnapshotId, limit: u64, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, iri_only_head: bool, head_prefixes: &[Vec<u8>], ) -> Result<Vec<EncodedTerm>, StorageError>
Axis head scan: distinct slot-0 head terms of the whole permutation
CF (SPOG subjects, PSOG predicates, OPSG objects, TSG classes).
Axis-local only.
Same skip-scan as Self::scan_domain with an empty constraint
prefix. limit counts emitted terms (0 = unlimited);
start_after_term is an exclusive resume cursor. iri_only_head
rejects non-NamedNode heads (FILTER(isIRI) pushdown). With non-empty
head_prefixes the walk is a seek-union over those partial head-term
byte ranges (opaque bytes; see
prepare_head_prefixes
for normalization and resume semantics); empty means the unfiltered
whole-CF walk.
Sourcepub fn max_commit_ts_under_prefixes(
&self,
permutation: IndexPermutation,
head_prefixes: &[Vec<u8>],
) -> Result<u64, StorageError>
pub fn max_commit_ts_under_prefixes( &self, permutation: IndexPermutation, head_prefixes: &[Vec<u8>], ) -> Result<u64, StorageError>
Max commit_ts among the versioned keys whose slot-0 head term falls
under head_prefixes (normalized like Self::scan_axis_head).
Stage 1 of the geo upgrade’s two-stage swap: the replacement ts must
dominate the newest version of every row it deletes, and the walked
data is the only authority for that bound — a freshly opened process’s
counter is 0 and says nothing about rows written by earlier processes,
and the wall clock may have drifted since they landed. Every versioned
key carries its commit_ts in the last COMMIT_TS_LEN bytes, so this
is a pure suffix scan: no liveness evaluation, no term decoding. Counting
superseded/dead versions too only ever overestimates the bound, which
is safe — a larger swap ts still sorts ahead of every row it deletes.
0 when no key matches.
Sourcepub fn count_axis_heads(
&self,
permutation: IndexPermutation,
snapshot: SnapshotId,
graph_name: Option<&EncodedTerm>,
graph_filter_terms: &[EncodedTerm],
graph_filter_allow: bool,
iri_only_head: bool,
) -> Result<u64, StorageError>
pub fn count_axis_heads( &self, permutation: IndexPermutation, snapshot: SnapshotId, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, iri_only_head: bool, ) -> Result<u64, StorageError>
Axis head count, TOTAL mode: the number of distinct slot-0 head
terms of the whole CF visible under the graph window. Same skip-walk
as Self::scan_axis_head — each emitted head seeks to its byte
successor — but the term is never materialized.
Sourcepub fn scan_axis_head_counts(
&self,
permutation: IndexPermutation,
snapshot: SnapshotId,
limit: u64,
start_after_term: Option<&EncodedTerm>,
graph_name: Option<&EncodedTerm>,
graph_filter_terms: &[EncodedTerm],
graph_filter_allow: bool,
iri_only_head: bool,
) -> Result<Vec<AxisHeadCountHit>, StorageError>
pub fn scan_axis_head_counts( &self, permutation: IndexPermutation, snapshot: SnapshotId, limit: u64, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, iri_only_head: bool, ) -> Result<Vec<AxisHeadCountHit>, StorageError>
Axis head count, PER_HEAD mode: one (head, count) hit per slot-0
head, count being the number of distinct slot-1 terms under it with
at least one visible row (TSG: per-class subject counts). Runs the
head prefix to EOF instead of skipping it; limit counts emitted
hits (0 = unlimited); start_after_term is the exclusive resume
cursor at head boundaries.
Sourcepub fn count_pattern_allow_list(
&self,
permutation: IndexPermutation,
pattern: &EncodedTriplePattern,
snapshot: SnapshotId,
limit: u64,
allow_list_slot: QuadSlot,
allow_terms: &[EncodedTerm],
graph_filter: GByteFilter,
merge_default_graph: bool,
) -> Result<Option<u64>, StorageError>
pub fn count_pattern_allow_list( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, allow_list_slot: QuadSlot, allow_terms: &[EncodedTerm], graph_filter: GByteFilter, merge_default_graph: bool, ) -> Result<Option<u64>, StorageError>
Count an allow-list scan with the full matcher semantics per tight
prefix — residual graph_filter membership and merge_default_graph
collapse inside each prefix’s RowMatcher, counting raw KeyRows
without decoding any term. limit counts post-filter matches
(0 = unlimited). Returns None when slot does not extend
permutation.
Sourcepub fn apply_geo_puts(&self, puts: &[GeoIndexPut]) -> Result<(), StorageError>
pub fn apply_geo_puts(&self, puts: &[GeoIndexPut]) -> Result<(), StorageError>
Apply geometry-index postings as one RocksDB WriteBatch (O axis).
Apply-and-skip-seek only: keys/values the compute side built are
persisted verbatim. Empty puts is a no-op.
Sourcepub fn delete_geo_term(&self, term: &[u8]) -> Result<u64, StorageError>
pub fn delete_geo_term(&self, term: &[u8]) -> Result<u64, StorageError>
Delete every versioned posting of one encoded geo term.
Covering cells for one term are not adjacent in cell-major order, so
this is a full-CF walk collecting matching keys, then one WriteBatch of
Deletes. NOT the rebuild path any more: waratah geo rebuild-index
wipes the whole CF in one pass (wipe_geo_index) — per-term walks
made the rebuild quadratic in terms × postings. This stays for the
partition RPC surface and single-term surgical use.
Sourcepub fn visit_geo_postings(
&self,
on_posting: &mut dyn FnMut(&GeoIndexPut) -> Result<(), StorageError>,
) -> Result<(), StorageError>
pub fn visit_geo_postings( &self, on_posting: &mut dyn FnMut(&GeoIndexPut) -> Result<(), StorageError>, ) -> Result<(), StorageError>
Visit every posting row, decoded, in CF order (read-only; the
census/debug surface). Rows stream cell-major with versions of one
logical (cell, term) key adjacent and newest first — the same
order GeoCandidateState collapses per logical key. A corrupt row
aborts the walk loudly: a diagnostic pass must not silently skip.
Sourcepub fn geo_index_epoch(&self) -> Result<Option<u64>, StorageError>
pub fn geo_index_epoch(&self) -> Result<Option<u64>, StorageError>
Rebuild epoch of the geometry index (O axis) — the TRUST decision.
Ok(None) on S/P (no CF) and when no epoch was ever stamped: every
consumer treats a missing epoch as UNTRUSTED (the flip from the
original missing-epoch-trusted default, because geography can be
ingested plugin-less, so an empty index is not proof of an empty
dataset). None also when the liveness marker is absent or disagrees
with the epoch: the postings were wiped without the epoch being
re-stamped, so the index is empty-but-“trusted” and must read
untrusted instead. A malformed value also reads as None.
Sourcepub fn set_geo_index_epoch(&self, epoch: u64) -> Result<(), StorageError>
pub fn set_geo_index_epoch(&self, epoch: u64) -> Result<(), StorageError>
Stamp the rebuild epoch of the geometry index (O axis) together with its liveness marker, in ONE write batch.
Called by waratah geo rebuild-index and by finish_geo_rebuild
after the postings were rewritten: the epoch is the max commit_ts
over the geo-contributing version rows the rebuild scanned, and
postings stamped at the epoch become visible exactly when the planner
starts trusting the index. Both keys land atomically — an epoch without
its marker is deliberately unreadable as a trust signal (see
Self::geo_index_epoch).
Sourcepub fn geo_index_epoch_number(&self) -> Result<u64, StorageError>
pub fn geo_index_epoch_number(&self) -> Result<u64, StorageError>
Raw stored epoch number, ignoring the liveness marker (0 when absent
or malformed, 0 on S/P).
Unlike Self::geo_index_epoch — which reads None unless marker and
number agree — this survives a wipe (wipe_geo_index drops the marker
but keeps the number), so finish_geo_rebuild can floor the new epoch
at the previously stamped one: a rebuild that writes nothing
counter-visible (no orphans; postings only) in a freshly opened process
would otherwise stamp 0 over a store whose data sits at higher ts.
Sourcepub fn geo_scan_candidates(
&self,
intervals: &[GeoCellInterval],
snapshot: SnapshotId,
query_envelope: Option<&GeoEnvelope>,
limit: u64,
state: &mut GeoCandidateState,
emit: impl FnMut(&EncodedTerm) -> Result<bool, StorageError>,
) -> Result<(), StorageError>
pub fn geo_scan_candidates( &self, intervals: &[GeoCellInterval], snapshot: SnapshotId, query_envelope: Option<&GeoEnvelope>, limit: u64, state: &mut GeoCandidateState, emit: impl FnMut(&EncodedTerm) -> Result<bool, StorageError>, ) -> Result<(), StorageError>
Skip-seek candidate scan over merged cell-id intervals (O axis).
ONE iterator walk with a seek per interval — never a full CF scan —
over the versioned geo_index keys, with the caller-owned
GeoCandidateState doing MVCC collapse, the per-stream DISTINCT, and
the optional envelope AABB reject. Decoded candidate terms stream to
emit; returning false stops early (limit reached / consumer gone).
limit of 0 is unlimited. Returns when every interval is drained,
emit stops, or limit distinct candidates were emitted.
Sourcepub fn apply_replace_pairs(
&self,
pairs: &[ReplacePair],
commit_ts: CommitTs,
) -> Result<u64, StorageError>
pub fn apply_replace_pairs( &self, pairs: &[ReplacePair], commit_ts: CommitTs, ) -> Result<u64, StorageError>
Apply replace pairs as ONE RocksDB WriteBatch on this axis: per
pair the old quad’s versioned rows are Deleted and the new quad’s
rows are Put at the shared commit_ts — no snapshot sees both rows
or neither. Served by every axis partition (each translates the
pairs into its own permutations). Empty pairs is a no-op.
Sourcepub fn wipe_geo_index(&self) -> Result<u64, StorageError>
pub fn wipe_geo_index(&self) -> Result<u64, StorageError>
Wipe every geo-index posting (O axis; rebuild preamble). The rebuild is an authoritative full replacement: the whole CF is dropped and re-derived from the hexastore under the rebuild lease.
Sourcepub fn apply_temporal_puts(
&self,
puts: &[TemporalIndexPut],
) -> Result<(), StorageError>
pub fn apply_temporal_puts( &self, puts: &[TemporalIndexPut], ) -> Result<(), StorageError>
Apply temporal-index postings as one RocksDB WriteBatch (O axis).
Apply-and-skip-seek only: keys/values the compute side built (or the
rebuild derived) are persisted verbatim. Empty puts is a no-op.
Sourcepub fn temporal_index_epoch(&self) -> Result<Option<u64>, StorageError>
pub fn temporal_index_epoch(&self) -> Result<Option<u64>, StorageError>
Rebuild epoch of the temporal index (O axis) — the TRUST decision.
Ok(None) on S/P (no CF) and when no epoch was ever stamped. Unlike
the geo index, a missing epoch is UNTRUSTED for the temporal rewrite:
temporal literals predate the plugin, so the compute auto-rebuild
triggers on it at startup and the epoch lands before queries serve.
None also when the tick-axis ORIGIN version recorded beside the
epoch disagrees with TEMPORAL_ORIGIN_VERSION. The origin moved
(B56: calendar families onto the stored dateTime origin), which
invalidates every posting key and every stored begin/end pair;
an index built under the old origin would otherwise read trusted while
its postings sit 306 days from where queries look.
Sourcepub fn set_temporal_index_epoch(&self, epoch: u64) -> Result<(), StorageError>
pub fn set_temporal_index_epoch(&self, epoch: u64) -> Result<(), StorageError>
Stamp the rebuild epoch of the temporal index (O axis).
Called by the partition-side rebuild after it rewrote the postings:
the epoch is the max commit_ts over the temporal-contributing
version rows the rebuild scanned, and postings stamped at the epoch
become visible exactly when the planner starts trusting the index.
Also stamps the tick-axis ORIGIN version, in the same batch, so the
two cannot diverge: an epoch without a matching origin version is
deliberately unreadable as a trust signal (see
Self::temporal_index_epoch).
Sourcepub fn temporal_scan_candidates(
&self,
intervals: &[TemporalCellInterval],
snapshot: SnapshotId,
predicate: &TemporalQueryPredicate,
limit: u64,
state: &mut TemporalCandidateState,
emit: impl FnMut(&EncodedTerm) -> Result<bool, StorageError>,
) -> Result<(), StorageError>
pub fn temporal_scan_candidates( &self, intervals: &[TemporalCellInterval], snapshot: SnapshotId, predicate: &TemporalQueryPredicate, limit: u64, state: &mut TemporalCandidateState, emit: impl FnMut(&EncodedTerm) -> Result<bool, StorageError>, ) -> Result<(), StorageError>
Skip-seek candidate scan over merged node-key intervals (O axis).
ONE iterator walk with a seek per interval — never a full CF scan —
over the versioned temporal_index keys, with the caller-owned
TemporalCandidateState doing MVCC collapse, the per-stream
DISTINCT, and the exact-interval reject. Decoded candidate terms
stream to emit; returning false stops early (limit reached /
consumer gone). limit of 0 is unlimited.
Sourcepub fn wipe_temporal_index(&self) -> Result<(), StorageError>
pub fn wipe_temporal_index(&self) -> Result<(), StorageError>
Wipe every temporal-index posting (O axis; rebuild preamble).
The rebuild is an authoritative full replacement: the whole CF is dropped and re-derived from the hexastore under the rebuild lock.
Sourcepub fn temporal_rebuild_terms(
&self,
) -> Result<(Vec<EncodedTerm>, CommitTs), StorageError>
pub fn temporal_rebuild_terms( &self, ) -> Result<(Vec<EncodedTerm>, CommitTs), StorageError>
Collect the O-axis temporal terms for the rebuild walk.
One linear pass over the leading O-permutation CF (object-major key
order). Rows for one object term are contiguous, and within that
block every distinct quad (the remaining key terms) has its version
rows adjacent, NEWEST FIRST (descending commit_ts suffix). A term is
collected when ANY quad referencing it has its own-latest version =
a visible Put (per-quad liveness): the index running AHEAD of the
store is harmless (a dead posted term joins nothing), while a live
term missing from it would silently drop rows. Deletes are never
mirrored to the postings (waratah_compute/src/fanout.rs sends none
on delete batches), so this walk after the whole-CF wipe is the
garbage collector of dead terms. Returns (terms, epoch): the alive
native temporal terms in walk order, and the max commit_ts over
every row carrying a temporal term (either op) — the epoch source.
Sourcepub fn flush_memtables(&self) -> Result<(), StorageError>
pub fn flush_memtables(&self) -> Result<(), StorageError>
Flush axis-local MemTables to SST files (no-op-equivalent wait on disk).
Sourcepub fn warm_block_cache(
&self,
fill_fraction: f64,
) -> Result<WarmBlockCacheStats, StorageError>
pub fn warm_block_cache( &self, fill_fraction: f64, ) -> Result<WarmBlockCacheStats, StorageError>
Warm this partition’s block cache: sequential walks over the
axis-local column families, stopping once usage reaches
fill_fraction of capacity (see [warm_walk]).
Data CFs (cf0/cf1) are walked first — they hold the scan blocks
queries need — then the smaller index/catalog CFs if capacity remains.
A fill_fraction of 0 (or below) disables the walk.
Sourcepub fn compact_range(&self)
pub fn compact_range(&self)
Compact both axis-local column families (tests / explicit rewrite).
Bottommost compaction is forced, so a trivial move is rewritten and
collectors run even when the flushed file had no waratah.stats.
Sourcepub fn compact_range_skip_bottommost(&self)
pub fn compact_range_skip_bottommost(&self)
Compact the same column families as Self::compact_range without
rewriting the bottommost level.
The L0 merge still runs. A file RocksDB only trivial-moves keeps the
waratah.stats blob written when it was flushed.
Sourcepub fn block_cache_bytes(&self) -> Option<(u64, u64)>
pub fn block_cache_bytes(&self) -> Option<(u64, u64)>
Process-wide block cache bytes: (capacity, charged usage) — the
same counters the warm pass targets. Cheap probe (counter read, no
I/O); covers both axis-local CFs and the catalog/index CFs (one
shared cache).
Sourcepub fn lsm_metrics(&self) -> LsmMetrics
pub fn lsm_metrics(&self) -> LsmMetrics
RocksDB LSM size / compaction counters for this partition.
Size and key estimates are summed across the axis-local indexes (and the
S-axis catalog CF). The empty default CF is not included.
Sourcepub fn hexastore_level0_files(&self) -> Option<u64>
pub fn hexastore_level0_files(&self) -> Option<u64>
rocksdb.num-files-at-level0 summed across the two hexastore CFs.
None when RocksDB does not report the property. A flush with
auto-compaction off leaves files here; a finished full-range compact
moves them to a lower level.
Sourcepub fn stats_property_blobs(
&self,
key: &[u8],
) -> Result<Vec<Vec<u8>>, StorageError>
pub fn stats_property_blobs( &self, key: &[u8], ) -> Result<Vec<Vec<u8>>, StorageError>
user_collected_properties blobs for key on the canonical stats CF,
the named-graph catalog CF (S axis), and the plugin-index CFs whose
table-properties collectors write under the same key (temporal
index; geo index for when its collector lands). Until audit B40 the
temporal CF was not read here, so the persisted tick histogram was
write-only: serialized into SSTs and never rolled up.