use crate::Id;
use crate::store::{Error, SessionMap};
use serde::Serialize;
use std::collections::HashMap;
use std::future::Future;
pub trait LayeredHotStore: Clone + Send + Sync + 'static {
fn set_multiple(
&self,
session_id: &Id,
pairs: &[(&str, &[u8], Option<i64>)],
) -> impl Future<Output = Result<i64, Error>> + Send;
}
pub trait LayeredColdStore: Clone + Send + Sync + 'static {
fn get_all_with_meta(
&self,
session_id: &Id,
) -> impl Future<Output = Result<Option<(SessionMap, HashMap<String, Option<i64>>)>, Error>> + Send;
fn set_with_meta<T: Serialize + Send + Sync + 'static>(
&self,
session_id: &Id,
field: &str,
value: &T,
key_ttl_secs: i64,
field_ttl_secs: i64,
hot_cache_ttl: Option<i64>,
) -> impl Future<Output = Result<i64, Error>> + Send;
fn set_and_rename_with_meta<T: Serialize + Send + Sync + 'static>(
&self,
old_session_id: &Id,
new_session_id: &Id,
field: &str,
value: &T,
key_ttl_secs: i64,
field_ttl_secs: i64,
hot_cache_ttl: Option<i64>,
) -> impl Future<Output = Result<i64, Error>> + Send;
}