pub trait DynContext: Send {
// Required methods
fn read(&self, key: &ContextKey) -> Result<Option<Value>, ContextError>;
fn write(
&mut self,
key: ContextKey,
value: Value,
) -> Result<(), ContextError>;
fn delete(&mut self, key: &ContextKey) -> Result<(), ContextError>;
fn dump(&self) -> Result<Value, ContextError>;
}Expand description
Dynamic context interface.
Contract:
dump()returns a full snapshot of current state (canonical JSON object recommended).- Implementations MUST ensure deterministic serialization of snapshot artifacts.
Required Methods§
Sourcefn read(&self, key: &ContextKey) -> Result<Option<Value>, ContextError>
fn read(&self, key: &ContextKey) -> Result<Option<Value>, ContextError>
Reads a raw JSON value from context.
Sourcefn write(&mut self, key: ContextKey, value: Value) -> Result<(), ContextError>
fn write(&mut self, key: ContextKey, value: Value) -> Result<(), ContextError>
Writes a raw JSON value into context.
Sourcefn delete(&mut self, key: &ContextKey) -> Result<(), ContextError>
fn delete(&mut self, key: &ContextKey) -> Result<(), ContextError>
Deletes a context entry if it exists.
Sourcefn dump(&self) -> Result<Value, ContextError>
fn dump(&self) -> Result<Value, ContextError>
Full snapshot of current context state.