pub struct AgentState {
pub session_id: SessionId,
pub vector_clock: VectorClock,
pub counters: HashMap<String, GCounter>,
pub sets: HashMap<String, GSet>,
pub registers: HashMap<String, LWWRegister<String>>,
pub maps: HashMap<String, ORMap>,
}Expand description
The full CRDT-backed shared state for a sync session.
Each field is a named map of CRDTs, allowing arbitrary named slots without requiring schema changes.
Fields§
§session_id: SessionIdUnique session identifier.
vector_clock: VectorClockVector clock tracking causal history across agents.
counters: HashMap<String, GCounter>Named grow-only counters.
sets: HashMap<String, GSet>Named grow-only sets.
registers: HashMap<String, LWWRegister<String>>Named last-write-wins string registers.
maps: HashMap<String, ORMap>Named observed-remove maps.
Implementations§
Source§impl AgentState
impl AgentState
Sourcepub fn with_session(self, id: SessionId) -> Self
pub fn with_session(self, id: SessionId) -> Self
Override the session id (builder pattern).
Sourcepub fn merge(&self, other: &AgentState) -> AgentState
pub fn merge(&self, other: &AgentState) -> AgentState
Merge another agent’s state into this one.
All merges are CRDT-compliant: commutative, associative, idempotent.
§Returns
A new AgentState representing the merged view.
Trait Implementations§
Source§impl Clone for AgentState
impl Clone for AgentState
Source§fn clone(&self) -> AgentState
fn clone(&self) -> AgentState
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for AgentState
impl Debug for AgentState
Source§impl Default for AgentState
impl Default for AgentState
Source§impl<'de> Deserialize<'de> for AgentState
impl<'de> Deserialize<'de> for AgentState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for AgentState
impl RefUnwindSafe for AgentState
impl Send for AgentState
impl Sync for AgentState
impl Unpin for AgentState
impl UnsafeUnpin for AgentState
impl UnwindSafe for AgentState
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more