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