Expand description
Types and utilities for handling sequences of tokens, including block creation and hashing.
Modules§
- blocks
- Block identification types for token sequences.
Structs§
- Partial
Token Block - Represents a partially filled block of tokens within a sequence.
- Positional
Lineage Hash - A 128-bit positional lineage hash encoding parental lineage for tree traversal.
- Positional
Radix Tree - Positionally sparse radix tree for efficient indexing of PositionalSequenceHashes.
- Positional
Sequence Hash - A 128-bit positional sequence hash combining traditional sequence hash with positional information.
- Token
Block - Represents a completed, immutable block of tokens with associated hashes.
- Token
Block MmInfo - Metadata describing a single multimodal placeholder run within a token sequence.
- Token
Block Sequence - Represents a sequence of tokens, segmented into fixed-size, hashed blocks.
- Tokens
- A collection of tokens, represented as a
Vec<Token>.
Enums§
- MmInfo
Error - Errors raised while validating
TokenBlockMmInfoinputs. - Token
Block Error - Errors that can occur during
PartialTokenBlockoperations.
Constants§
- CHAIN_
XXH3_ SEED - Canonical XXH3 seed used by every chain-step
(parent_seq, child_block_hash) → next_seqin this codebase. Must matchdynamo_kv_router::protocols::XXH3_SEED— the router’scompute_seq_hash_for_blockand thePositionalIndexer’s chain re-computation both route throughcompute_next_sequence_hash(or equivalently seeded helpers inkv-router), so changing this constant requires all of them to flip in lockstep. - 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.
Traits§
- Positional
Hash - Trait for hashes that include position information.
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_
next_ sequence_ hash - Chain-step for sequence hashing: returns the
SequenceHashatposition + 1given the parent’sSequenceHashand the child block’sBlockHash. - 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
- A salt used for hashing, represented as a vector of bytes. This might encode model architecture, weights, PEFT info, etc.
- 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.