Skip to main content

dynamo_kv_hashing/
lib.rs

1// SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
2// SPDX-License-Identifier: Apache-2.0
3
4#![deny(missing_docs)]
5
6//! Universal `Request → Vec<PositionalLineageHash>` contract for KV cache identity.
7//!
8//! See `README.md` for the design rationale (the three-representation problem, why PLH
9//! wins, the multimodal gap, and the extension-vs-PLH-alone caveat). This crate is the
10//! single contract that the router, consolidator, kvbm, and framework workers should
11//! converge on for block hashing.
12//!
13//! # Pure-computation contract
14//!
15//! This crate is intentionally a library, not a service. It contains no async, no
16//! transports, no traits over runtime/scheduler config, and no event types. Those
17//! belong in higher layers (kvbm-connector, consolidator, kv-router).
18
19mod block;
20mod compute;
21mod error;
22mod request;
23mod salt;
24
25pub use block::UniversalBlock;
26pub use error::KvHashingError;
27pub use request::{Request, RequestBuilder, RequestMmObjectInfo};
28
29// Re-export the underlying primitives so consumers can depend solely on this crate.
30pub use dynamo_tokens::{
31    BlockHash, MM_SLOT_TAG_PLACEHOLDER, MM_SLOT_TAG_TOKEN, MmInfoError, PositionalLineageHash,
32    SaltHash, SequenceHash, Token, TokenBlockMmInfo, compute_block_bytes_with_mm,
33    compute_block_hash, compute_hash_v2, compute_salt_hash_from_bytes, validate_and_sort_mm_info,
34};