Skip to main content

Module encode

Module encode 

Source
Expand description

Term and quad encoding into RocksDB-compatible keys.

Structs§

AxisHeadCountHit
One (head, distinct slot-1 count) hit from an axis head count scan in per-head mode.
CatalogPut
One catalog put staged into the S-axis named_graphs_catalog CF.
CatalogRebuildStats
Stats from crate::Storage::rebuild_named_graph_catalog.
ComparisonMask
Compiled slot comparisons for one scan.
DomainScanCountHit
One (constraint, head, run length) triple from a domain count scan.
DomainScanHit
One distinct (constraint, head) pair from a domain scan.
DyadicCovererConfig
Coverer configuration (temporal twin of the S2 coverer params): the node budget is per interval, the level window bounds grid coarseness. Process configuration on compute; the rebuild receives it over the RPC so policy stays compute-owned even though the partition executes the walk.
DyadicNode
A dyadic node of the key space: level 0..=128, width 2^(128-level) keys starting at the multiple index · 2^(128-level). Level 128 is the single-key leaf (an instant’s exact tick). Nodes order by (level, index) — coarse first — which is the deterministic serialization order.
EncodedQuad
Encoded quad (subject, predicate, object, graph).
EncodedTriplePattern
Ground or partially-bound encoded triple/quad pattern.
GeoCandidateState
State machine for one GeoCandidateScan stream: MVCC collapse per logical (cell, term) key and a DISTINCT seen-set over full term bytes.
GeoCellInterval
One merged, sorted cell-id interval to probe (compute-built from a covering: descendant [range_min, range_max] ranges ∪ exact ancestor ids).
GeoEnvelope
CRS84 AABB of one geometry, as packed on a posting value.
GeoIndexPut
One staged geometry-index posting (compute-built; O applies verbatim).
GeoIndexRow
Raw (key, value) rows of one geo-index scan, in CF order.
HexastorePut
One prepared hexastore Put targeting an axis-local column family.
HexastoreVersion
One encoded version used to prepare axis-local index puts (no DB access).
IriOnlyMask
IRI-only slot flags pushed by the planner (FILTER(isIRI(?x)) pushdown).
KeyRow
One raw versioned hexastore row handed to a scan’s emit callback.
RowMatcher
Compiled per-scan row matcher replacing per-row key decoding.
RunCounter
Per-run counting state for one (constraint, head) run.
SlotComparison
One slot OP term comparison attached to a scan.
SmallString
A small inline string stored in 16 bytes (payload + length in byte 15).
SnapshotScanState
State machine for descending-commit_ts prefix scans under a snapshot.
SortedTightAllowList
Sorted unique allow-list terms with encoded prefixes for a multi-seek scan.
StrHash
SipHash-2-4 digest of a UTF-8 string (big-endian on the wire).
StrHashIdentityBuildHasher
BuildHasher that treats StrHash as pre-hashed via its upper 64 bits.
TemporalCandidateState
State machine for one TemporalCandidateScan stream: MVCC collapse per logical (node_key, term) key, a DISTINCT seen-set over full term bytes (one interval posts under up to max_nodes non-adjacent node keys), and the exact-interval reject.
TemporalCellInterval
One merged, sorted key interval to probe (compute-built from a covering: per-node descendant ranges ∪ exact ancestor keys as single-value ranges).
TemporalIndexPut
One staged temporal-index posting (compute-built or rebuild-derived; the O partition applies it verbatim).
TemporalShape
The exact tick interval one stored temporal term covers. Projected once at ingest and carried verbatim in every posting value; the partition rejects against it without interpreting datatypes.

Enums§

BadSmallStringError
Error building a SmallString.
CompareOp
Comparison applied by one SlotComparison.
CrsId
Ingest CRS recorded on native geo terms (one byte on the wire).
DomainCountMode
What one run-count increment of a domain count scan represents.
EncodedTerm
Encoded RDF term for storage keys and wire transfer.
GByteFilter
Byte-level residual graph-membership window (twin of the old decoded-term GraphMembership).
GWindowKind
Walk-entry classification of the G window, computed once per walk.
GeoCandidateDecision
Outcome of one geo-index candidate decision.
GeoDatatype
Geo literal datatype recorded on native geo terms (one byte on the wire).
GeomKind
Geometry shape class recorded on EncodedTerm::LiteralGeometry (one byte on the wire; points carry their kind implicitly). The low three bits carry the kind; the high bits are reserved for geometry flags.
GraphCatalogState
Presence / drop marker stored as a single byte.
HeadVerdict
Per-key visibility verdict for a head walk: the head term’s byte range within the key, or “not visible”.
IndexPermutation
Hexastore index key permutation.
MatchDecision
Verdict of RowMatcher::matches_row for one visited row.
QuadSlot
Slot within an encoded quad.
TemporalCandidateDecision
Outcome of one temporal-index candidate decision.
TemporalQueryPredicate
Exact interval predicate a TemporalCandidateScan applies per candidate (partition-side, integer-only). The scan’s key intervals already produce a superset; this drops postings whose exact pair misses, before the wire.

Constants§

ATTO_PER_DAY
Attoseconds in one day.
ATTO_PER_HOUR
Attoseconds in one hour.
ATTO_PER_MINUTE
Attoseconds in one minute.
ATTO_PER_SECOND
Attoseconds in one second.
ATTO_TZ_INDETERMINATE
The XSD 14-hour rule: a timezone-absent xsd:dateTime / xsd:date is order-indeterminate against a timezone-present value by at most ±14 h (oxsdatatypes implements the same bound in its PartialOrd). A timezone-absent term posts the uncertainty interval [t − ATTO_TZ_INDETERMINATE, t + ATTO_TZ_INDETERMINATE] — widened by the full day length for xsd:date, whose value is a day of unknown anchoring, not an instant — so every timezone-qualified window overlapping any possible reading finds it; the exact per-row predicate (the engine’s own comparison) decides.
CATALOG_MIN_PREFIX_SIZE
Prefix extractor length: named-node type byte + 16-byte hash (same as SPOG).
COMMIT_TS_LEN
Length of the descending commit_ts key suffix.
EMPTY_STR_HASH
SipHash-2-4 of the empty string (k0 = k1 = 0).
EMPTY_STR_LITERAL
Empty small string literal ("", SPARQL LANG of an untagged literal).
ENCODED_TERM_FALSE
Canonical encoded XSD false (wire type 29).
ENCODED_TERM_TRUE
Canonical encoded XSD true (wire type 28).
GEO_AABB_PAD_DEGREES
Ingest-time envelope reject padding, in degrees (see the plan: a conservative reject must never drop a true candidate because f64 → f32 rounded the box inward; 4-byte lon/lat truncates near 1e-5°, so the compare-time epsilon is an order of magnitude larger).
GEO_CELL_ID_LEN
Fixed prefix length of the S2 cell id in every geo-index key.
GEO_EPOCH_VALUE_LEN
Byte length of a persisted epoch value (big-endian u64).
GEO_HISTOGRAM_BUCKET_LEVEL
Bucket-grid level of the geo cell-count histogram: every posting counts into its level-11 ancestor bucket (or, for postings coarser than 11, into the histogram’s coarse side — see GEO_HISTOGRAM_COARSE_FLOOR_LEVEL).
GEO_HISTOGRAM_COARSE_FLOOR_LEVEL
Postings at a level below this floor go to the histogram’s coarse side (keyed by their native cell id) instead of expanding into 4^(11 − level) level-11 buckets. Level 9 bounds the fine expansion at 4^2 = 16 buckets per posting; coarser postings (level 8 and below) stay individual count-once entries. Level 8 was moved onto the coarse side (2026-10) because its 64-bucket expansion multiplied a small posting population into half the fine map’s wire mass on real corpora (18.6k L8 postings = 1.19M of 2.37M incidences on bellendena-geo-10m), while the count-once rung prices such a posting as ONE candidate — the estimate’s actual unit. One continent-scale polygon still cannot make a flush collector emit millions of increments: levels 0–7 were always coarse-side.
GEO_INDEX_CF
RocksDB column-family name. Opened only on crate::PartitionAxis::O.
GEO_INDEX_EPOCH_KEY
The one reserved key in GEO_INDEX_META_CF: the rebuild epoch as 8-byte big-endian (u64 commit_ts).
GEO_INDEX_LIVENESS_KEY
The other reserved key in GEO_INDEX_META_CF: the rebuild LIVENESS marker, holding the epoch it was stamped with (8-byte big-endian).
GEO_INDEX_META_CF
RocksDB column-family name for geo-index metadata. Opened only on crate::PartitionAxis::O. Two reserved keys (the rebuild epoch and its liveness marker) — no walker ever touches it, so reserved keys are unambiguous.
GEO_LIVENESS_VALUE_LEN
Byte length of a persisted liveness marker (big-endian u64 epoch).
GEO_WKB_LITERAL
The geo:wkbLiteral datatype IRI (GeoSPARQL 1.1 core).
GEO_WKT_LITERAL
The geo:wktLiteral datatype IRI (GeoSPARQL 1.1 core).
MERGE_NEXT_CHAIN_LIMIT
How many same-prefix Next() advances the merge walks chain before paying one Seek() to finish the variant chain.
MERGE_TRIPLE_PREFIX_MAX
Maximum byte length of a 4-slot key’s S/P/O prefix (three encoded terms).
NAMED_GRAPHS_CATALOG_CF
RocksDB column-family name. Opened only on crate::PartitionAxis::S.
OMIT_GRAPH
omitted_slots bit for the graph slot.
OMIT_NONE
No slot omitted.
OMIT_OBJECT
omitted_slots bit for the object slot.
OMIT_PREDICATE
omitted_slots bit for the predicate slot.
OMIT_SUBJECT
omitted_slots bit for the subject slot.
RDF_LANG_STRING
Encoded rdf:langString named node — SPARQL 1.1 DATATYPE of a language-tagged string.
RDF_LANG_STRING_IRI_ID
rdf:langString.
RDF_TYPE
Encoded rdf:type named node — equality checks and TSG decode injection.
RDF_TYPE_IRI_ID
SipHash-2-4 of http://www.w3.org/1999/02/22-rdf-syntax-ns#type (k0 = k1 = 0).
STORAGE_VALUE_LEN
Fixed length of a hexastore record value (op + visibility).
TEMPORAL_EPOCH_VALUE_LEN
Byte length of a persisted epoch value (big-endian u64).
TEMPORAL_INDEX_CF
RocksDB column-family name. Opened only on crate::PartitionAxis::O.
TEMPORAL_INDEX_EPOCH_KEY
The one reserved key in TEMPORAL_INDEX_META_CF: the rebuild epoch as 8-byte big-endian (u64 commit_ts).
TEMPORAL_INDEX_META_CF
RocksDB column-family name for temporal-index metadata (two reserved keys: the rebuild epoch and its tick-axis origin version). Opened only on crate::PartitionAxis::O.
TEMPORAL_INDEX_ORIGIN_KEY
The other reserved key in TEMPORAL_INDEX_META_CF: the version of the tick-axis ORIGIN an epoch was stamped under.
TEMPORAL_KEY_LEN
Byte length of a node start key in every temporal-index key.
TEMPORAL_ORIGIN_VALUE_LEN
Byte length of a persisted origin-version value (big-endian u64).
TEMPORAL_ORIGIN_VERSION
Current tick-axis origin version. Bump ONLY when [AXIS_ORIGIN_DAYS] changes — i.e. when the calendar-to-stored alignment moves.
TEMPORAL_VALUE_LEN
Value length: op + visibility + exact begin + exact end.
TERM_WIDTH
Total encoded width in bytes (type byte included) per term type id.
TERM_WIDTH_UNKNOWN
TERM_WIDTH entry for type ids that never begin a stored term: unassigned ids, [TYPE_PLACEHOLDER], and reserved [TYPE_TRIPLE].
WRITTEN_TERM_MAX_SIZE
Upper bound on encoded term size for buffer pre-allocation.
XSD_BOOLEAN
Encoded xsd:boolean.
XSD_BOOLEAN_IRI_ID
xsd:boolean.
XSD_BYTE_IRI_ID
xsd:byte.
XSD_DATE
Encoded xsd:date.
XSD_DATE_IRI_ID
xsd:date.
XSD_DATE_TIME
Encoded xsd:dateTime.
XSD_DATE_TIME_IRI_ID
xsd:dateTime.
XSD_DAY_TIME_DURATION
Encoded xsd:dayTimeDuration.
XSD_DAY_TIME_DURATION_IRI_ID
xsd:dayTimeDuration.
XSD_DECIMAL
Encoded xsd:decimal.
XSD_DECIMAL_IRI_ID
xsd:decimal.
XSD_DOUBLE
Encoded xsd:double.
XSD_DOUBLE_IRI_ID
xsd:double.
XSD_DURATION
Encoded xsd:duration.
XSD_DURATION_IRI_ID
xsd:duration.
XSD_FLOAT
Encoded xsd:float.
XSD_FLOAT_IRI_ID
SipHash-2-4 of SPARQL numeric XSD datatype IRIs (k0 = k1 = 0).
XSD_G_DAY
Encoded xsd:gDay.
XSD_G_DAY_IRI_ID
xsd:gDay.
XSD_G_MONTH
Encoded xsd:gMonth.
XSD_G_MONTH_DAY
Encoded xsd:gMonthDay.
XSD_G_MONTH_DAY_IRI_ID
xsd:gMonthDay.
XSD_G_MONTH_IRI_ID
xsd:gMonth.
XSD_G_YEAR
Encoded xsd:gYear.
XSD_G_YEAR_IRI_ID
xsd:gYear.
XSD_G_YEAR_MONTH
Encoded xsd:gYearMonth.
XSD_G_YEAR_MONTH_IRI_ID
xsd:gYearMonth.
XSD_INTEGER
Encoded xsd:integer.
XSD_INTEGER_IRI_ID
xsd:integer.
XSD_INT_IRI_ID
xsd:int.
XSD_LONG_IRI_ID
xsd:long.
XSD_NEGATIVE_INTEGER_IRI_ID
xsd:negativeInteger.
XSD_NON_NEGATIVE_INTEGER_IRI_ID
xsd:nonNegativeInteger.
XSD_NON_POSITIVE_INTEGER_IRI_ID
xsd:nonPositiveInteger.
XSD_POSITIVE_INTEGER_IRI_ID
xsd:positiveInteger.
XSD_SHORT_IRI_ID
xsd:short.
XSD_STRING
Encoded xsd:string.
XSD_STRING_IRI_ID
xsd:string.
XSD_TIME
Encoded xsd:time.
XSD_TIME_IRI_ID
xsd:time.
XSD_UNSIGNED_BYTE_IRI_ID
xsd:unsignedByte.
XSD_UNSIGNED_INT_IRI_ID
xsd:unsignedInt.
XSD_UNSIGNED_LONG_IRI_ID
xsd:unsignedLong.
XSD_UNSIGNED_SHORT_IRI_ID
xsd:unsignedShort.
XSD_YEAR_MONTH_DURATION
Encoded xsd:yearMonthDuration.
XSD_YEAR_MONTH_DURATION_IRI_ID
xsd:yearMonthDuration.

Traits§

StrResolver
Source of raw strings for hash-referenced terms.
TermReader
Read encoded terms from a byte buffer.

Functions§

aabb_disjoint_padded
Conservative AABB disjointness: true = this row can be skipped.
aabb_skip_for_lon_wrap
True when either side spans at least half the globe in longitude: raw min/max comparison is meaningless for antimeridian-crossing boxes, so the AABB reject must be skipped (conservative — the candidate survives to Relate).
align_down_key
Snap a key DOWN to its containing level-level node’s start key.
byte_successor
Increment-with-carry exclusive successor of key.
catalog_graphs_from_versions
Distinct named-node graphs from Put versions, with the earliest commit_ts.
catalog_prefix
Term bytes used as the catalog key prefix (no timestamp).
classify_g_window
Classify a G window into the cheapest per-row test with the same verdict as domain_graph_allows.
collapse_merged_default_triples
Collapse physical quads to the RDF merge of a SPARQL default graph.
collect_dedup_visible_catalog_graphs
Fold a catalog CF (or memory map) into the named graphs visible at snapshot.
consider_axis_head_key
MVCC + optional G window for one bare axis-head key (head at offset 0).
consider_head_key
MVCC + optional G window for one versioned index key.
cover_axis_range
Cover the inclusive key range [begin_key, end_key] with dyadic nodes.
days_from_civil
Days since the proleptic-Gregorian era for a calendar date (Howard Hinnant’s days_from_civil), valid for the full i64 year range.
decide_slot_comparison
Decide one slot comparison against one encoded term.
decode_catalog_key
Decode a catalog key into the graph IRI and commit timestamp.
decode_catalog_value
Decode the 1-byte catalog value.
decode_geo_epoch
Decode a persisted geo-index epoch.
decode_geo_liveness
Decode a persisted liveness marker (the epoch it was stamped with).
decode_graph_name
Rebuild a graph name, mapping EncodedTerm::DefaultGraph to the default graph.
decode_index_key
Decode a hexastore index key written in permutation order.
decode_index_key_omitting
decode_index_key for a request that may omit slots.
decode_named_node_term
Decode exactly one EncodedTerm::NamedNode from bytes.
decode_storage_value
Decode a 5-byte hexastore value into (op, visibility).
decode_temporal_epoch
Decode a persisted temporal-index epoch.
decode_temporal_origin
Decode the tick-axis origin version (None when absent or malformed).
decode_temporal_posting_value
Decode one temporal-index posting value: op(u8) ‖ visibility(u32 BE) ‖ begin(i128 BE) ‖ end(i128 BE) — 37 bytes.
decode_term
Rebuild an Term from its encoded form.
decode_versioned_key
Decode a versioned hexastore key into the logical quad and commit timestamp.
dedup_state_newest_catalog_graph
Deduplicate catalog graphs in the State by their IRI. If this catalog version is the newest visible at snapshot, return the graph IRI. If this catalog version is Dropped, return None.
domain_graph_allows
Residual / bound-G membership after a snapshot-visible version is chosen.
domain_graph_unconstrained
Block-list empty and graph_name unset: do not decode G.
encode_catalog_key
Versioned catalog key: encoded named node ‖ descending commit_ts.
encode_geo_epoch
Encode a persisted geo-index epoch as 8-byte big-endian.
encode_geo_liveness
Encode the liveness marker for epoch.
encode_index_key
Build a hexastore index key for quad in permutation order.
encode_quad
Encode a quad for hexastore index writes.
encode_storage_value
Encode op ‖ visibility as a fixed 5-byte value.
encode_temporal_epoch
Encode a persisted temporal-index epoch as 8-byte big-endian.
encode_temporal_origin
Encode the tick-axis origin version.
encode_term
Encode an RDF term for storage keys and wire transfer.
encode_term_bytes
Encode a single term to bytes.
encode_versioned_key
Build a versioned hexastore key: term bytes ‖ descending commit_ts.
geo_cell_level
S2 level of a u64 cell id: the trailing 1-bit sentinel sits at bit 60 − 2·level. Returns None for a malformed id (sentinel at an odd bit position, above bit 60, or a face value ≥ 6 — S2 defines six faces, so bits 63–61 holding 6 or 7 is not a cell).
geo_l8_parent_index
Level-8 parent bucket index of a level-11 dense index: dropping the low 6 Hilbert bits (22 − 16) yields face ‖ 16 Hilbert bits (19 bits). The histogram’s coarse remainder summary groups dropped L11 buckets by this parent so a wire-trimmed map still carries each region’s total mass.
geo_l11_bucket_index
Dense level-11 bucket index of cell_id’s L11 ancestor: face ‖ 22 Hilbert bits (25 bits). Defined for any cell at level ≥ 11.
geo_l11_bucket_range
Inclusive level-11 dense-index range covered by cell_id.
geo_lexical_key
Deterministic strings-map key for a native geo term’s rendered lexical form.
graph_hops_after_head
How many encoded terms sit between the walked head’s end and the G term inside a versioned key.
graph_region
Byte region of the G term inside a versioned key: starts hops terms after the walked head’s end (graph_hops_after_head), ends at the logical prefix. The default graph’s region is empty.
hashes_in_term
Hashes that must be resolved before term can be decoded.
head_prefix_resume_seek
Seek key that starts (or resumes) the walk of one normalized head prefix, given the exclusive encoded-start_after_term resume cursor.
head_resume_seek
Seek key for constraint given an exclusive (start_after_constraint, start_after_term) resume cursor.
head_term_from_region
Decode the term occupying region — a HeadVerdict::Candidate range sliced from its key, or a saved copy of one (encoded terms are valid standalone, so a flush can decode from a copy after the iterator moved on).
intervals_for_nodes
Merge a covering into the interval list (the temporal twin of geo’s intervals_for_covering): each node contributes its inclusive descendant range plus the exact start key of every proper ancestor (which catch postings coarser than the query node — outward-snapped interval postings and coarse-level instants’ containing beacons). Deduped, sorted by key.
is_catalog_graph
True when term is a SPARQL named-graph IRI (catalog member).
is_numeric_encoded
SPARQL isNUMERIC: native numeric variants, or a typed literal whose datatype IRI hash is one of the XSD numeric types (including ill-formed lexicals such as "foo"^^xsd:integer).
key_u128_to_tick
Inverse of tick_to_key_u128.
merge_triple_skip_seek
Exclusive seek past every G (and version) of this S/P/O prefix.
month_start_tick
First tick of one calendar month (y, m).
new_str_blob_map
Empty StrBlobMap.
new_str_hash_map
Empty StrHashMap.
new_str_hash_set
Empty StrHashSet.
next_month_start_tick
First tick of the month AFTER (y, m) (December rolls the year).
next_year_start_tick
First tick of the year AFTER y.
omitted_slot_term
Term a receiver puts back for a slot the sender omitted.
postings_for_term
Compute the postings for one temporal term: the instant’s exact leaf, or the budgeted covering of its interval (each node files the term under the node’s start key). Returns an empty vec for unprojectable terms (they ingest unindexed; the residual path answers).
prefixed_iri_name
Prefixed (Turtle/SPARQL-style) name for an IRI under a [WELL_KNOWN_NAMESPACES] namespace, e.g. owl:Class for http://www.w3.org/2002/07/owl#Class. None for IRIs outside those namespaces.
prepare_constraints
Validate slot-0 constraint terms and drop duplicates.
prepare_constraints_sorted
Validate, dedupe, and sort constraints by encoded key bytes.
prepare_head_prefixes
Normalize a head-prefix filter for a prefix-filtered axis head walk.
prepare_hexastore_puts
Encode every axis-local index put for versions without touching storage.
record_first_put_graph
Record the earliest Put commit_ts for each named graph in a SPOG version scan.
region_after_head
Extent of the term directly following a walked head region inside a versioned key — the component the counts walks fold into their distinct-term / distinct-graph counters, and the PER_HEAD walk’s slot-1.
require_catalog_graph
Reject the RDF default graph and non-IRI graph names.
stage_catalog_puts
Stage Present versions for graphs whose newest catalog state is missing or Dropped.
strings_entries_for_term
Collect (hash, raw) pairs that must be registered in “strings” for an encoded term.
temporal_term_interval
Project a native temporal term onto the tick axis.
term_in_quad_slot
Term in slot of quad.
term_width_at
Total encoded width of the term starting at key[offset] (type byte included).
tick_from_date
Midnight tick of a calendar date on the SHARED tick axis, None on representable-range overflow (the tick must fit the i128 attosecond axis; values that fail here can never exist as parsed temporal terms anyway — the parser bounds are the representable bounds).
tick_to_key_u128
Map a signed tick to its order-preserving key-space u128 (biased / offset binary: XOR the sign bit).
triple_prefix_len
Byte length of the S/P/O prefix of a 4-slot logical key.
versioned_key_term_prefix
Term-prefix portion of a versioned key (excludes the commit_ts suffix).
versioned_parts
Split a versioned key into its term prefix and commit timestamp without decoding any terms.
well_known_iri
Static IRI for a well-known RDF/RDFS/OWL/SKOS/XSD hash.
well_known_prefixed_iri
Prefixed name for a well-known RDF/RDFS/OWL/SKOS/XSD hash — the compact counterpart of well_known_iri (rdfs:label, xsd:integer, …).
write_term
Write an encoded term to sink.

Type Aliases§

StrBlobMap
HashMap from StrHash → blob payload bytes using upper-64 identity hashing (the blob-payload mirror of StrHashMap).
StrHashMap
HashMap from StrHash → String using upper-64 identity hashing.
StrHashSet
HashSet of StrHash using upper-64 identity hashing.