use std::any::Any;
use async_trait::async_trait;
#[async_trait]
pub trait StateStore: Any + Send {
fn name(&self) -> &str;
async fn flush(&mut self);
fn close(&mut self);
fn as_any_mut(&mut self) -> &mut dyn Any;
fn changelog_topic(&self) -> &str;
fn take_changelog(&mut self) -> Vec<(bytes::Bytes, Option<bytes::Bytes>)>;
async fn apply_changelog(&mut self, key: bytes::Bytes, value: Option<bytes::Bytes>);
fn set_logging(&mut self, on: bool);
fn as_iq(&self) -> Option<&dyn crate::store::iq::IqQueryable> {
None
}
async fn clear(&mut self);
}
#[async_trait]
pub trait KeyValueStore<K: Send + Sync, V: Send>: StateStore {
async fn get(&self, key: &K) -> Option<V>;
async fn put(&mut self, key: K, value: V);
async fn delete(&mut self, key: &K) -> Option<V>;
async fn range(&self, lo: &K, hi: &K) -> Vec<(K, V)>;
}