use crate::HashMap;
use super::{error::CacheError, CacheStoreKey};
pub type CacheStoreItemRef<'a> = dashmap::mapref::one::MappedRef<'a, String, Vec<u8>, Vec<u8>>;
pub trait CacheStoreTrait: Send + Sync {
fn has_cache(&self, name: &str) -> bool;
fn is_cache_changed(&self, store_key: &CacheStoreKey) -> bool;
fn write_single_cache(&self, store_key: CacheStoreKey, bytes: Vec<u8>) -> Result<(), CacheError>;
#[allow(unused_variables)]
fn write_cache(&self, cache_map: HashMap<CacheStoreKey, Vec<u8>>) {}
fn read_cache(&self, name: &str) -> Option<Vec<u8>>;
fn read_cache_ref(&self, name: &str) -> Option<CacheStoreItemRef<'_>>;
fn remove_cache(&self, name: &str) -> Option<Vec<u8>>;
fn shutdown(&self) {}
}
pub const FARM_CACHE_VERSION: &str = "0.9.0";
pub const FARM_CACHE_MANIFEST_FILE: &str = "farm-cache.json";
pub trait CacheStoreFactory: Send + Sync {
fn create_cache_store(&self, name: &str) -> Box<dyn CacheStoreTrait>;
}