Skip to main content

waratah_storage/
lib.rs

1//! Waratah storage brick: encoding, string registry, and hexastore indexes.
2//!
3//! RDF surface types come from [`oxrdf`] (re-exported here for ergonomics).
4//! Waratah-owned modules (`encode`, `registry`, `rocksdb`, `memory`) implement
5//! partition-local storage; encoded [`StrHash`] values stay on the wire during
6//! query execution — raw strings are resolved only for final output bindings.
7
8#![deny(unused_must_use)]
9#![warn(missing_docs)]
10
11mod blob_index;
12pub mod encode;
13pub mod error;
14pub mod layout;
15pub mod memory;
16pub mod metrics;
17pub mod registry;
18pub mod rocksdb;
19mod rocksdb_db;
20pub mod storage;
21pub mod text_index;
22pub mod types;
23pub mod warm_state;
24pub mod worker_pool;
25
26#[cfg(test)]
27mod test_util;
28
29pub use oxrdf::{
30    BlankNode, GraphName, Literal, NamedNode, NamedNodeRef, NamedOrBlankNode, Quad, Term, Triple,
31    Variable, vocab,
32};
33
34pub use blob_index::{BLOB_INDEX_CF, BlobIndex, BlobIndexBatch, Iter as BlobIndexIter};
35pub use encode::{
36    ATTO_PER_DAY, ATTO_PER_HOUR, ATTO_PER_MINUTE, ATTO_PER_SECOND, ATTO_TZ_INDETERMINATE,
37    AxisHeadCountHit, CATALOG_MIN_PREFIX_SIZE, CatalogPut, CatalogRebuildStats, CompareOp,
38    ComparisonMask, CrsId, DomainCountMode, DomainScanCountHit, DomainScanHit, DyadicCovererConfig,
39    DyadicNode, EMPTY_STR_HASH, EMPTY_STR_LITERAL, ENCODED_TERM_FALSE, ENCODED_TERM_TRUE,
40    EncodedQuad, EncodedTerm, EncodedTriplePattern, GByteFilter, GEO_CELL_ID_LEN,
41    GEO_HISTOGRAM_BUCKET_LEVEL, GEO_HISTOGRAM_COARSE_FLOOR_LEVEL, GEO_INDEX_CF, GEO_WKB_LITERAL,
42    GEO_WKT_LITERAL, GeoCandidateState, GeoCellInterval, GeoDatatype, GeoEnvelope, GeoIndexPut,
43    GeomKind, GraphCatalogState, HexastorePut, HexastoreVersion, IndexPermutation, IriOnlyMask,
44    KeyRow, NAMED_GRAPHS_CATALOG_CF, OMIT_GRAPH, OMIT_NONE, OMIT_OBJECT, OMIT_PREDICATE,
45    OMIT_SUBJECT, QuadSlot, RDF_LANG_STRING, RDF_LANG_STRING_IRI_ID, RDF_TYPE, RDF_TYPE_IRI_ID,
46    SlotComparison, SmallString, StrBlobMap, StrHash, StrHashIdentityBuildHasher, StrHashMap,
47    StrHashSet, StrResolver, TEMPORAL_INDEX_CF, TemporalCandidateState, TemporalCellInterval,
48    TemporalIndexPut, TemporalQueryPredicate, TemporalShape, TermReader, XSD_BOOLEAN,
49    XSD_BOOLEAN_IRI_ID, XSD_BYTE_IRI_ID, XSD_DATE, XSD_DATE_IRI_ID, XSD_DATE_TIME,
50    XSD_DATE_TIME_IRI_ID, XSD_DAY_TIME_DURATION, XSD_DAY_TIME_DURATION_IRI_ID, XSD_DECIMAL,
51    XSD_DECIMAL_IRI_ID, XSD_DOUBLE, XSD_DOUBLE_IRI_ID, XSD_DURATION, XSD_DURATION_IRI_ID,
52    XSD_FLOAT, XSD_FLOAT_IRI_ID, XSD_G_DAY, XSD_G_DAY_IRI_ID, XSD_G_MONTH, XSD_G_MONTH_DAY,
53    XSD_G_MONTH_DAY_IRI_ID, XSD_G_MONTH_IRI_ID, XSD_G_YEAR, XSD_G_YEAR_IRI_ID, XSD_G_YEAR_MONTH,
54    XSD_G_YEAR_MONTH_IRI_ID, XSD_INT_IRI_ID, XSD_INTEGER, XSD_INTEGER_IRI_ID, XSD_LONG_IRI_ID,
55    XSD_NEGATIVE_INTEGER_IRI_ID, XSD_NON_NEGATIVE_INTEGER_IRI_ID, XSD_NON_POSITIVE_INTEGER_IRI_ID,
56    XSD_POSITIVE_INTEGER_IRI_ID, XSD_SHORT_IRI_ID, XSD_STRING, XSD_STRING_IRI_ID, XSD_TIME,
57    XSD_TIME_IRI_ID, XSD_UNSIGNED_BYTE_IRI_ID, XSD_UNSIGNED_INT_IRI_ID, XSD_UNSIGNED_LONG_IRI_ID,
58    XSD_UNSIGNED_SHORT_IRI_ID, XSD_YEAR_MONTH_DURATION, XSD_YEAR_MONTH_DURATION_IRI_ID,
59    align_down_key, byte_successor, catalog_graphs_from_versions, catalog_prefix,
60    collapse_merged_default_triples, cover_axis_range, decide_slot_comparison, decode_catalog_key,
61    decode_catalog_value, decode_graph_name, decode_index_key, decode_index_key_omitting,
62    decode_named_node_term, decode_storage_value, decode_term, decode_versioned_key,
63    encode_catalog_key, encode_index_key, encode_quad, encode_storage_value, encode_term,
64    encode_term_bytes, encode_versioned_key, geo_cell_level, geo_l8_parent_index,
65    geo_l11_bucket_index, geo_l11_bucket_range, geo_lexical_key, hashes_in_term,
66    intervals_for_nodes, is_catalog_graph, is_numeric_encoded, key_u128_to_tick, new_str_blob_map,
67    new_str_hash_map, new_str_hash_set, omitted_slot_term, postings_for_term, prefixed_iri_name,
68    prepare_hexastore_puts, require_catalog_graph, strings_entries_for_term,
69    temporal_term_interval, tick_from_date, tick_to_key_u128, well_known_iri,
70    well_known_prefixed_iri,
71};
72pub use error::StorageError;
73pub use layout::{
74    BLOB_DIR_NAME, BLOB_INDEX_DIR_NAME, BLOB_SEGMENTS_DIR_NAME, INGEST_DIR_NAME,
75    MAIN_REPOSITORY_ID, NOTEBOOKS_DIR_NAME, NOTEBOOKS_RUNTIME_DIR_NAME, blob_index_dir,
76    blob_segments_dir, blob_store_dir, hexastore_data_dir, ingest_root_dir, ingest_staging_dir,
77    notebooks_root_dir, notebooks_runtime_dir, notebooks_venv_dir, queries_repo_dir,
78    registry_data_dir, registry_sst_staging_dir, repository_store_dir, text_index_dir_beside,
79};
80pub use metrics::LsmMetrics;
81pub use registry::{
82    InMemoryRegistryShard, REGISTRY_CF, REGISTRY_DIR_NAME, Registry, RegistryShard,
83    RocksDbRegistry, ShardedRegistry, delete_partial_registry_sst_runs, finished_registry_sst_runs,
84    registry_entries_for_quad, resolve_bindings, resolve_multiget_env_enabled, shard_id_for_hash,
85};
86pub use rocksdb::{
87    BULK_MAX_WRITE_BUFFER_NUMBER, BULK_WRITE_BUFFER_BYTES, COMPACTION_READAHEAD_BYTES,
88    DEFAULT_BLOCK_SIZE_BYTES, DEFAULT_ITERATOR_READAHEAD_BYTES, DEFAULT_MAX_WRITE_BUFFER_NUMBER,
89    DEFAULT_WRITE_BUFFER_BYTES, PREFIX_FILTER_BITS_PER_KEY, REGISTRY_BLOCK_SIZE_BYTES,
90    RocksDbOptionsHooks, RocksDbTuning, WARM_CACHE_FILL_FRACTION, WARM_CACHE_PROBE_INTERVAL,
91    WarmBlockCacheStats, disable_auto_compactions, hexastore_readahead_env_bytes,
92    iterator_readahead_bytes, pin_index_env_enabled, scan_async_io_env_enabled,
93    sst_filter_env_enabled, warm_cache_env_enabled,
94};
95pub use storage::{STORAGE_BACKEND_ENV, Storage, StorageBackendKind, WRITE_BATCH_MAX_QUADS};
96pub use text_index::{
97    ANALYZERS, DEFAULT_ANALYZER, DEFAULT_SEED_CHARS, LANG_NONE, MAX_SEED_CHARS, RAW_TOKENIZER,
98    TextCandidateMode, TextIndexDoc, TextSearchRequest, TextSubjectRequest, TextSubjectRow,
99    registered_analyzer, text_index_key,
100};
101pub use types::{
102    CommitTs, PartitionAxis, ReplacePair, ScanExhaustion, ScanPage, SnapshotId, StorageOp,
103    VisibilityLabel,
104};
105pub use warm_state::{WARM_MAX_WAIT, WarmState};
106pub use worker_pool::{effective_width, init_worker_pool, init_worker_pool_from_env};