pub struct KeywordState {
pub live_indices: Vec<u64>,
pub index_to_doc: HashMap<u64, [u8; 16]>,
pub total_writes: u64,
pub epoch: Epoch,
}Expand description
Everything the client knows about one keyword.
Serialised as part of ClientStateTable and encrypted with K_state.
Fields§
§live_indices: Vec<u64>Indices of live (non-deleted) entries for this keyword in the EDB.
Each index i maps to EDB tag: PRF(K_tag, keyword || i || epoch)
This is the authoritative source for O(1) search token generation.
index_to_doc: HashMap<u64, [u8; 16]>Maps EDB index → document UUID. Used during delete to find which
indices to evict from live_indices.
total_writes: u64Monotonically increasing total write counter (never decremented). Provides unique, fresh indices for every add even after deletes.
epoch: EpochCurrent epoch. Incremented on every delete for this keyword. Old tags (from prior epochs) become permanently unreachable — this is the mechanism behind Backward Security Type-II.
Implementations§
Source§impl KeywordState
impl KeywordState
Sourcepub fn next_index(&mut self) -> u64
pub fn next_index(&mut self) -> u64
Allocate the next fresh index for an add operation.
Returns the index; callers must push it into live_indices themselves.
Sourcepub fn record_add(&mut self, index: u64, doc_id: Uuid)
pub fn record_add(&mut self, index: u64, doc_id: Uuid)
Register a newly written index → doc mapping.
Trait Implementations§
Source§impl Clone for KeywordState
impl Clone for KeywordState
Source§fn clone(&self) -> KeywordState
fn clone(&self) -> KeywordState
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more