pub struct PrefixFingerprint {
pub system_stable_hash: u64,
pub system_knowledge_hash: u64,
pub turn_hashes: Vec<u64>,
}Expand description
Per-render fingerprint of the cacheable prefix — the segments a provider
caches as a stable prefix (system blocks + history turns). Excludes
state_turn (the volatile uncached tail) and token_count metadata (not on the
wire). This is the metrics-first instrument (P0-A) behind the optimization work:
two renders share a reusable KV / prompt-cache prefix iff their system hashes
match and one’s turn_hashes is a prefix of the other’s. Pure and derived —
never stored in snapshots, session logs, or event logs.
Fields§
§system_stable_hash: u64§system_knowledge_hash: u64§turn_hashes: Vec<u64>One stable hash per history turn, in order. The longest common prefix with a previous render’s vector = how many turns stay cache-reusable across the call.
Implementations§
Source§impl PrefixFingerprint
impl PrefixFingerprint
Sourcepub fn extends(&self, prev: &PrefixFingerprint) -> bool
pub fn extends(&self, prev: &PrefixFingerprint) -> bool
True when self’s cacheable prefix is a byte-stable extension of prev:
identical system segments and prev.turn_hashes is a prefix of
self.turn_hashes. This is exactly the KV / prompt-cache reuse condition —
no drift anywhere in the prefix, only growth at the tail.
Sourcepub fn common_turn_prefix(&self, prev: &PrefixFingerprint) -> usize
pub fn common_turn_prefix(&self, prev: &PrefixFingerprint) -> usize
Number of leading turns byte-identical to prev — the reusable turn-prefix
length. A drop below prev.turn_hashes.len() signals mid-prefix churn (a
turn rewritten in place, e.g. an in-place collapse) that invalidates cache.
Trait Implementations§
Source§impl Clone for PrefixFingerprint
impl Clone for PrefixFingerprint
Source§fn clone(&self) -> PrefixFingerprint
fn clone(&self) -> PrefixFingerprint
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for PrefixFingerprint
impl Debug for PrefixFingerprint
impl Eq for PrefixFingerprint
Source§impl PartialEq for PrefixFingerprint
impl PartialEq for PrefixFingerprint
Source§fn eq(&self, other: &PrefixFingerprint) -> bool
fn eq(&self, other: &PrefixFingerprint) -> bool
self and other values to be equal, and is used by ==.