use super::StateSnapshot;
use std::collections::HashMap;
use std::sync::Arc;
use tokio::sync::RwLock;
#[derive(Clone)]
pub struct MemoryStateManager {
pub(super) states: Arc<RwLock<HashMap<String, Vec<u8>>>>,
#[allow(clippy::type_complexity)]
pub(super) snapshots: Arc<RwLock<HashMap<String, (Vec<u8>, StateSnapshot)>>>,
}
impl MemoryStateManager {
pub fn new() -> Self {
Self {
states: Arc::new(RwLock::new(HashMap::new())),
snapshots: Arc::new(RwLock::new(HashMap::new())),
}
}
}
impl Default for MemoryStateManager {
fn default() -> Self {
Self::new()
}
}