Skip to main content

Storage

Enum Storage 

Source
pub enum Storage {
    Memory {
        axis: PartitionAxis,
        store: RwLock<MemoryStorage>,
    },
    RocksDb(RocksDbStorage),
}
Expand description

Single-partition hexastore storage brick.

Both backends are always compiled. RocksDB is the production path; the in-memory backend is selected explicitly or via STORAGE_BACKEND_ENV.

Variants§

§

Memory

In-memory backend for fast unit tests and local prototyping.

Behind an RwLock: unlike RocksDB, the BTreeMaps have no internal concurrency, so every Storage access takes a lock. Scans hold a shared read guard for the whole walk, so concurrent readers on one partition (e.g. a probe stream while a driver walk is parked on backpressure) proceed together; writes take the write guard and exclude readers for their duration. The walk’s guard spans the caller’s callback: the text subject resolve emits frames from inside it and blocks when the consumer is behind, so a slow consumer stalls writers to this partition for the length of the stream. RocksDB reads a snapshot iterator and takes no such lock; this is a memory-backend limitation, accepted for its test/prototyping role (a real fix needs a resumable batched walk or a persistent snapshot store). axis sits outside the lock: it is immutable metadata, not store state.

Fields

§axis: PartitionAxis

Immutable partition axis (metadata, not store state).

§store: RwLock<MemoryStorage>

BTreeMap state, guarded because it has no internal concurrency.

§

RocksDb(RocksDbStorage)

RocksDB-backed hexastore.

Implementations§

Source§

impl Storage

Source

pub fn memory(axis: PartitionAxis) -> Self

Open an empty in-memory store for axis.

Source

pub fn open_rocksdb( path: impl AsRef<Path>, axis: PartitionAxis, ) -> Result<Self, StorageError>

Open a RocksDB store at path for axis.

Creates the directory and axis-local column families if missing.

Source

pub fn open_rocksdb_with_hooks( path: impl AsRef<Path>, axis: PartitionAxis, hooks: RocksDbOptionsHooks<'_>, ) -> Result<Self, StorageError>

Open RocksDB with optional collector / listener hooks.

Source

pub fn open_with_backend( kind: StorageBackendKind, path: impl AsRef<Path>, axis: PartitionAxis, ) -> Result<Self, StorageError>

Open a store using kind (RocksDB uses path; memory ignores it).

Source

pub fn open_from_env( path: impl AsRef<Path>, axis: PartitionAxis, ) -> Result<Self, StorageError>

Open using StorageBackendKind::from_env (default RocksDB).

Source

pub fn backend_kind(&self) -> StorageBackendKind

Backend kind of this instance.

Source

pub fn axis(&self) -> PartitionAxis

Partition axis this store owns.

Source

pub fn text_index_dir(&self) -> Option<PathBuf>

Where the text plugin’s Tantivy directory belongs, or None when the backend has no persistent home.

The location follows the storage backend, not the process mode: a RocksDB partition keeps the index beside its hexastore directory so a delete of the data dir removes both, and the memory backend keeps the index in RAM where it vanishes with the store it mirrors.

Source

pub fn lsm_metrics(&self) -> Option<LsmMetrics>

RocksDB LSM counters (None on the memory backend).

Source

pub fn block_cache_bytes(&self) -> Option<(u64, u64)>

Process-wide block cache bytes: (capacity, charged usage). None on the memory backend.

Source

pub fn hexastore_level0_files(&self) -> Option<u64>

L0 SST files on the two hexastore column families.

None on the memory backend. A flush with auto-compaction off leaves files here; a finished full-range compact moves them to a lower level.

Source

pub fn insert_quad(&self, quad: &Quad) -> Result<(), StorageError>

Insert a quad as a Put at commit_ts = 0, visibility = 0.

Source

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).

Source

pub fn insert_encoded_quad_version( &self, encoded: &EncodedQuad, commit_ts: CommitTs, op: StorageOp, visibility: VisibilityLabel, ) -> Result<(), StorageError>

Insert an already-encoded quad version.

This is the partition-service write path: compute encodes a quad once and fans the encoded form out to S, P, and O, so raw strings never reach a hexastore node.

Source

pub fn apply_prepared_puts( &self, puts: &[HexastorePut], ) -> Result<(), StorageError>

Apply pre-encoded axis-local index puts.

RocksDB commits them in one WriteBatch. Memory inserts into the BTreeMaps. Empty puts is a no-op. Does not update the named-graph catalog.

Source

pub fn apply_prepared_puts_with_catalog( &self, puts: &[HexastorePut], catalog: &[CatalogPut], ) -> Result<(), StorageError>

Apply hexastore index puts and named-graph catalog puts together.

Catalog puts require the S axis. Empty puts and empty catalog is a no-op.

Source

pub fn catalog_puts_for_insert( &self, graphs: &[(EncodedTerm, CommitTs)], ) -> Result<Vec<CatalogPut>, StorageError>

Prefix-seek the S-axis catalog and stage Present when missing or Dropped.

Source

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.

S-axis only. No-op if the newest catalog version is already Present.

Source

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. S-axis only.

Source

pub fn rebuild_named_graph_catalog( &self, ) -> Result<CatalogRebuildStats, StorageError>

Rebuild named_graphs_catalog from all SPOG versions (S axis only).

Source

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).

Source

pub fn apply_geo_puts(&self, puts: &[GeoIndexPut]) -> Result<(), StorageError>

Apply geometry-index postings (O axis only; apply-only, verbatim).

Source

pub fn delete_geo_term(&self, term: &[u8]) -> Result<u64, StorageError>

Delete every posting of one encoded geo term (O axis; rebuild).

Source

pub fn visit_geo_postings( &self, on_posting: &mut dyn FnMut(&GeoIndexPut) -> Result<(), StorageError>, ) -> Result<(), StorageError>

Visit every geometry-index posting, decoded, in key order (O axis; read-only census/debug surface).

Source

pub fn geo_index_epoch(&self) -> Result<Option<u64>, StorageError>

Rebuild epoch of the O-axis geometry index.

Ok(None) on S/P and when no epoch was ever stamped; every consumer treats a missing epoch as “index trusted from store creation”.

Source

pub fn set_geo_index_epoch(&self, epoch: u64) -> Result<(), StorageError>

Stamp the rebuild epoch of the O-axis geometry index.

Errors with StorageError::GeoIndexNotOnAxis on S/P.

Source

pub fn geo_index_epoch_number(&self) -> Result<u64, StorageError>

Raw stored geo epoch number, ignoring the liveness marker (0 when absent, 0 on S/P). Survives a wipe, so the rebuild finish can floor the new epoch at the previously stamped one.

Source

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 (geo upgrade stage 1: the swap-timestamp bound, derived from the walked data itself).

Source

pub fn apply_replace_pairs( &self, pairs: &[ReplacePair], commit_ts: CommitTs, ) -> Result<u64, StorageError>

Apply replace pairs as ONE batch on this axis (see the backend docs; served by every axis partition).

Source

pub fn wipe_geo_index(&self) -> Result<u64, StorageError>

Wipe every geo-index posting (O axis; rebuild preamble). ONE scan, ONE atomic batch — the posting deletes and the LIVENESS-marker drop commit together, so an interrupted rebuild after this point reads UNTRUSTED instead of trusted-with-a-partial-index. Returns the number of posting rows deleted.

Source

pub fn apply_temporal_puts( &self, puts: &[TemporalIndexPut], ) -> Result<(), StorageError>

Apply temporal-index postings (O axis only; apply-only, verbatim).

Source

pub fn temporal_index_epoch(&self) -> Result<Option<u64>, StorageError>

Rebuild epoch of the O-axis temporal index (None = untrusted).

Source

pub fn set_temporal_index_epoch(&self, epoch: u64) -> Result<(), StorageError>

Stamp the rebuild epoch of the O-axis temporal index.

Errors with StorageError::TemporalIndexNotOnAxis on S/P.

Source

pub fn wipe_temporal_index(&self) -> Result<(), StorageError>

Wipe every temporal-index posting (O axis; rebuild preamble).

Source

pub fn temporal_rebuild_terms( &self, ) -> Result<(Vec<EncodedTerm>, CommitTs), StorageError>

Collect the O-axis temporal terms for the rebuild walk (see the backend docs for the per-quad liveness contract).

Source

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).

Source

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).

Source

pub fn scan_pattern( &self, pattern: &EncodedTriplePattern, snapshot: SnapshotId, ) -> Result<Vec<EncodedQuad>, StorageError>

Prefix/range scan returning encoded quads visible at snapshot.

Newest version with commit_ts <= snapshot and op == Put wins per logical quad. Visibility labels are not enforced yet.

Source

pub fn scan_pattern_in( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, ) -> Result<Vec<EncodedQuad>, StorageError>

Scan through an explicitly chosen axis-local index.

Returns StorageError::PermutationNotOwned when permutation belongs to another partition axis, so a partition service can reject a mis-routed request instead of panicking.

Source

pub fn scan_pattern_with_comparisons( &self, pattern: &EncodedTriplePattern, snapshot: SnapshotId, comparisons: &[SlotComparison], ) -> Result<Vec<EncodedQuad>, StorageError>

Self::scan_pattern with slot comparisons on the best permutation for pattern.

Source

pub fn scan_pattern_in_with_comparisons( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, comparisons: &[SlotComparison], ) -> Result<Vec<EncodedQuad>, StorageError>

Self::scan_pattern_in with slot comparisons.

Source

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 on raw key bytes. limit counts post-filter matches (0 = unlimited). Returns None when slot does not extend permutation; otherwise the page plus the walk’s own ScanExhaustion verdict.

Source

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 run 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.

Source

pub fn visit_allow_list_rows( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, start_after: Option<&EncodedQuad>, allow_list_slot: QuadSlot, allow_terms: &[EncodedTerm], graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, on_match: impl FnMut(&KeyRow<'_>) -> Result<bool, StorageError>, ) -> Result<Option<ScanExhaustion>, StorageError>

Stream every visible matching row of an allow-list scan as raw KeyRow key slices; on_match returning false stops the walk early (the caller owns the stop reason — including any limit, which counts post-filter, post-collapse matches). Full matcher semantics per tight prefix: residual graph_filter membership, merge_default_graph collapse, and iri_only pushdown run inside each prefix’s RowMatcher on raw key bytes. Returns Ok(None) when slot does not extend permutation (caller should bind each term instead); Ok(Some(verdict)) otherwise — Limited when the callback stopped the walk at the limit, ExhaustedFilterTerms when every term’s prefix was served.

Source

pub fn visit_allow_list_rows_with_comparisons( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, start_after: Option<&EncodedQuad>, allow_list_slot: QuadSlot, allow_terms: &[EncodedTerm], graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, comparisons: &[SlotComparison], on_match: impl FnMut(&KeyRow<'_>) -> Result<bool, StorageError>, ) -> Result<Option<ScanExhaustion>, StorageError>

Self::visit_allow_list_rows with slot comparisons compiled inside this call. An emptied mask returns ExhaustedScan without opening an iterator.

Source

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).

Returns StorageError::PermutationNotOwned when permutation belongs to another partition axis. limit counts emitted pairs (0 = unlimited).

Source

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 (twin of Self::scan_domain).

Returns StorageError::PermutationNotOwned when permutation belongs to another partition axis. limit counts emitted triples (0 = unlimited). mode selects what one run-count increment represents — see DomainCountMode.

Source

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: distinct slot-0 head terms of the whole CF. Twin of Self::scan_axis_head.

Source

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: per-head distinct slot-1 counts.

Source

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).

Returns StorageError::PermutationNotOwned when permutation belongs to another partition axis. limit counts emitted terms (0 = unlimited). With non-empty head_prefixes the walk is a seek-union over those partial head-term byte ranges; empty means the unfiltered whole-CF walk.

Source

pub fn scan_predicate_domain( &self, predicates: &[EncodedTerm], snapshot: SnapshotId, limit: u64, start_after_predicate: Option<&EncodedTerm>, start_after_object: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<DomainScanHit>, StorageError>

Distinct objects per predicate (POSG skip-scan). P-axis only.

Source

pub fn scan_subject_preds( &self, subjects: &[EncodedTerm], snapshot: SnapshotId, limit: u64, start_after_subject: Option<&EncodedTerm>, start_after_predicate: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<DomainScanHit>, StorageError>

Distinct predicates per subject (SPOG skip-scan). S-axis only.

Source

pub fn scan_subject_domain( &self, subjects: &[EncodedTerm], snapshot: SnapshotId, limit: u64, start_after_subject: Option<&EncodedTerm>, start_after_object: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<DomainScanHit>, StorageError>

Distinct objects per subject (SOPG skip-scan). S-axis only.

Source

pub fn scan_object_preds( &self, objects: &[EncodedTerm], snapshot: SnapshotId, limit: u64, start_after_object: Option<&EncodedTerm>, start_after_predicate: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<DomainScanHit>, StorageError>

Distinct predicates per object (OPSG skip-scan). O-axis only.

Source

pub fn scan_subjects( &self, snapshot: SnapshotId, limit: u64, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<EncodedTerm>, StorageError>

Distinct subjects of the whole SPOG index. S-axis only.

Source

pub fn scan_predicates( &self, snapshot: SnapshotId, limit: u64, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<EncodedTerm>, StorageError>

Distinct predicates of the whole PSOG index. P-axis only.

Source

pub fn scan_objects( &self, snapshot: SnapshotId, limit: u64, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<EncodedTerm>, StorageError>

Distinct objects of the whole OPSG index. O-axis only.

Source

pub fn scan_classes( &self, snapshot: SnapshotId, limit: u64, start_after_term: Option<&EncodedTerm>, graph_name: Option<&EncodedTerm>, graph_filter_terms: &[EncodedTerm], graph_filter_allow: bool, ) -> Result<Vec<EncodedTerm>, StorageError>

Distinct classes of the whole TSG index (rdf:type objects). O-axis only.

Source

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.

Source

pub fn count_pattern_in( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, ) -> Result<u64, StorageError>

Count through an explicitly chosen axis-local index.

Returns StorageError::PermutationNotOwned when permutation belongs to another partition axis. limit of 0 is unlimited.

Source

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. Returns the page plus the walk’s own ScanExhaustion verdict.

Source

pub fn visit_pattern_quads( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, limit: u64, start_after: Option<&EncodedQuad>, graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, on_match: impl FnMut(EncodedQuad) -> Result<bool, StorageError>, ) -> Result<ScanExhaustion, StorageError>

Streaming variant of Self::scan_pattern_page: the callback receives each visible quad as it is decoded and returns false to stop the walk. limit counts post-filter matches (0 = unlimited) and is edge-triggered exactly like the page API’s, so a caller with its own stopping rule passes 0 and uses the callback’s return value.

The verdict is the walker’s ScanExhaustion; a callback stop is not distinguished there, so the callback’s own false is the signal.

Source

pub fn visit_object_subjects( &self, objects: &[EncodedTerm], predicates: &[EncodedTerm], snapshot: SnapshotId, graph_name: Option<&EncodedTerm>, graph_filter: &GByteFilter, merge_default_graph: bool, visit: impl FnMut(&EncodedTerm, &EncodedTerm) -> Result<bool, StorageError>, ) -> Result<(), StorageError>

Resolve (object, predicate) rows to their subjects through the O axis’s OPSG index.

objects are the resolved literals the candidate drain produced. They arrive in ascending encoded-term order — OPSG is O‖P‖S‖G, so that is also RocksDB key order, which the shared iterator below requires (it only steps forward). The whole list is ONE allow-list walk: a single iterator over the CF, seeked once per object to its prefix. Recreating an iterator per object costs several microseconds each — several seconds over a broad match set — so the allow-list road is the point of this method.

An object’s prefix covers every predicate it appears under; the predicates set is therefore an in-memory membership test, not part of the key prefix (an empty list restricts nothing). A literal is usually stored under one of the named predicates, so a walk per (object, predicate) would seek twice more per object to prefixes that cannot hold a row.

Rows are the raw (subject, graph) pairs: a subject reached through several objects or predicates repeats, and the caller dedups (and enforces its own distinct-subject budget). Visibility and graph semantics are Self::scan_pattern_page’s — a Delete newer than snapshot hides its row, and graph_filter / merge_default_graph apply exactly as they do to a ScanPattern request. visit returns false to stop early (a caller’s budget reached).

O axis only: OPSG is the permutation this store owns.

Source

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, comparisons: &[SlotComparison], ) -> Result<ScanPage, StorageError>

Prefix scan with the full matcher semantics and slot comparisons applied inside the walk. comparisons is compiled once for this permutation; a predicate storage cannot decide keeps the row, so the compute-side copy remains authoritative.

Source

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, comparisons: &[SlotComparison], ) -> Result<Option<ScanPage>, StorageError>

Allow-list prefix scan with slot comparisons applied inside each tight prefix’s walk.

Source

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 — residual graph_filter membership and merge_default_graph collapse inside the RowMatcher, counting raw KeyRows without decoding any term. limit counts post-filter matches (0 = unlimited). Counts are not resumable: there is no cursor.

Source

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 for the sliced full-axis count. The memory backend has no walks and ignores the hint; the RocksDB backend uses it only for the TSG full-axis shape (see RocksDbStorage::count_pattern_impl_with_class_totals).

Source

pub fn flush_memtables(&self) -> Result<(), StorageError>

Flush MemTables to SST files (RocksDB); no-op for the memory backend.

Source

pub fn compact_range(&self)

Compact both axis-local CFs (RocksDB); no-op for the memory backend.

Bottommost compaction is forced, so a trivial move is rewritten and collectors run even when the flushed file had no waratah.stats.

Source

pub fn warm_block_cache( &self, fill_fraction: f64, ) -> Result<WarmBlockCacheStats, StorageError>

Warm this partition’s block cache (see RocksDbStorage::warm_block_cache). No-op on the memory backend: there is no block cache, so the stats come back zeroed.

Source

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. No-op for the memory backend.

Source

pub fn stats_property_blobs( &self, key: &[u8], ) -> Result<Vec<Vec<u8>>, StorageError>

SST user_collected_properties blobs for key on the canonical stats CF and the S-axis named-graph catalog CF.

Empty for the memory backend.

Source

pub fn visit_pattern_rows( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, start_after: Option<&EncodedQuad>, graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, on_match: impl FnMut(&KeyRow<'_>) -> Result<bool, StorageError>, ) -> Result<ScanExhaustion, StorageError>

Stream every visible matching row to emit in one index walk; emit returning false stops the walk early (the caller owns the stop reason). Rows arrive as raw KeyRow key slices — callers decode or copy out what they need. graph_filter is the residual graph membership window; merge_default_graph collapses same-triple rows (G last in every index) to the first visible one. Same visibility / cursor contract as Self::scan_pattern_page with limit = 0. iri_only rejects non-NamedNode S/O segments per the planner’s FILTER(isIRI(?x)) pushdown. Returns the walk’s ScanExhaustion verdict: Limited when the callback stopped it at the limit, ExhaustedScan when it left the pattern’s key range.

Source

pub fn visit_pattern_rows_with_comparisons( &self, permutation: IndexPermutation, pattern: &EncodedTriplePattern, snapshot: SnapshotId, start_after: Option<&EncodedQuad>, graph_filter: GByteFilter, merge_default_graph: bool, iri_only: IriOnlyMask, comparisons: &[SlotComparison], on_match: impl FnMut(&KeyRow<'_>) -> Result<bool, StorageError>, ) -> Result<ScanExhaustion, StorageError>

Self::visit_pattern_rows with slot comparisons compiled inside this call. An emptied mask returns ExhaustedScan without opening an iterator.

Trait Implementations§

Source§

impl Debug for Storage

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

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<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> 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 = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

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

§

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

§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,