Expand description
Universal Request → Vec<PositionalLineageHash> contract for KV cache identity.
See README.md for the design rationale (the three-representation problem, why PLH
wins, the multimodal gap, and the extension-vs-PLH-alone caveat). This crate is the
single contract that the router, consolidator, kvbm, and framework workers should
converge on for block hashing.
§Pure-computation contract
This crate is intentionally a library, not a service. It contains no async, no transports, no traits over runtime/scheduler config, and no event types. Those belong in higher layers (kvbm-connector, consolidator, kv-router).
Structs§
- Positional
Lineage Hash - A 128-bit positional lineage hash encoding parental lineage for tree traversal.
- Request
- Canonical Request used to derive a deterministic sequence of block hashes.
- Request
Builder - Builder for
Request. - Request
MmObject Info - Multimodal placeholder run as carried on a
Request. - Token
Block MmInfo - Metadata describing a single multimodal placeholder run within a token sequence.
- Universal
Block - Per-block hashing result. PLH is self-contained for chain extension via
PositionalLineageHash::extend; no out-of-band tracking required.
Enums§
- KvHashing
Error - Errors raised while constructing a
crate::Requestor computing block hashes. - MmInfo
Error - Errors raised while validating
TokenBlockMmInfoinputs.
Constants§
- MM_
SLOT_ TAG_ PLACEHOLDER - Slot-tag byte for multimodal placeholder slots. See
compute_block_bytes_with_mm. - MM_
SLOT_ TAG_ TOKEN - Slot-tag byte distinguishing real-token slots from multimodal placeholder slots in
the per-block byte buffer. See
compute_block_bytes_with_mm.
Functions§
- compute_
block_ bytes_ with_ mm - Builds the byte buffer used to compute a block’s
BlockHash. - compute_
block_ hash - Canonical
BlockHashconstruction: XXH3 over the per-block byte buffer (already encoded bycompute_block_bytes_with_mmorcast_slicefor the no-MM path), seeded bySaltHash. - compute_
hash_ v2 - Computes a hash of the data using the given seed (raw u64).
- compute_
salt_ hash_ from_ bytes - Canonical
SaltHashconstruction from a pre-canonicalized salt-payload byte buffer. Application-layer callers should usedynamo_kv_hashing::Request::salt_hashwhich canonicalizes(salt, lora_name)first; this function is the low-level path. - validate_
and_ sort_ mm_ info - Validates
mm_infoagainsttokens_lenand returns a copy sorted byoffset.
Type Aliases§
- Block
Hash - A 64-bit hash computed from the tokens within a single block (with optional MM
frames), seeded by the request’s
SaltHash. - Salt
Hash - A 64-bit hash of the salt. Computed once per request and used as the seed for every block-hash computation in that request.
- Sequence
Hash - A 64-bit sequence-aware hash. Equals the
BlockHashat position 0 andcompute_next_sequence_hash(prev_seq, block_hash)at every subsequent position. Salt propagates throughseq_hash[0]sinceblock_hash[0]already encodes it. - Token
- A token is represented as a 32-bit unsigned integer.