adk_session/state.rs
1use serde_json::Value;
2use std::collections::HashMap;
3
4/// Mutable key-value state store for a session.
5pub trait State: Send + Sync {
6 /// Returns the value for the given key, or `None` if not present.
7 fn get(&self, key: &str) -> Option<Value>;
8 /// Sets a key-value pair in the state.
9 fn set(&mut self, key: String, value: Value);
10 /// Returns all key-value pairs in the state.
11 fn all(&self) -> HashMap<String, Value>;
12}
13
14/// Read-only view of session state.
15pub trait ReadonlyState: Send + Sync {
16 /// Returns the value for the given key, or `None` if not present.
17 fn get(&self, key: &str) -> Option<Value>;
18 /// Returns all key-value pairs in the state.
19 fn all(&self) -> HashMap<String, Value>;
20}