cyfs_bdt/ndn/chunk/cache/raw_cache/
common.rs

1use std::path::PathBuf;
2use cyfs_base::*;
3use cyfs_util::{
4    AsyncWriteWithSeek, 
5    AsyncReadWithSeek, 
6    SyncWriteWithSeek, 
7    SyncReadWithSeek
8};
9
10
11#[async_trait::async_trait]
12pub trait RawCache: Send + Sync {
13    fn capacity(&self) -> usize;
14    fn clone_as_raw_cache(&self) -> Box<dyn RawCache>;
15    async fn async_reader(&self) -> BuckyResult<Box<dyn Unpin + Send + Sync + AsyncReadWithSeek>>;
16    fn sync_reader(&self) -> BuckyResult<Box<dyn SyncReadWithSeek + Send + Sync>>;
17    async fn async_writer(&self) -> BuckyResult<Box<dyn  Unpin + Send + Sync + AsyncWriteWithSeek>>;
18    fn sync_writer(&self) -> BuckyResult<Box<dyn SyncWriteWithSeek>>;
19}
20
21
22
23#[derive(Clone)]
24pub struct RawCacheConfig {
25    pub mem_capacity: usize, 
26    pub tmp_dir: PathBuf
27}