refactor(tvix/store): impl Default for MemoryChunkService
Change-Id: If1ceb870e9e5d03b651923a3a786350a8663e990 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8236 Autosubmit: flokli <flokli@flokli.de> Tested-by: BuildkiteCI Reviewed-by: tazjin <tazjin@tvl.su>
This commit is contained in:
parent
e716bd0957
commit
b3d6e70909
2 changed files with 2 additions and 10 deletions
|
|
@ -9,19 +9,11 @@ use crate::Error;
|
|||
|
||||
use super::ChunkService;
|
||||
|
||||
#[derive(Clone)]
|
||||
#[derive(Clone, Default)]
|
||||
pub struct MemoryChunkService {
|
||||
db: Arc<RwLock<HashMap<Vec<u8>, Vec<u8>>>>,
|
||||
}
|
||||
|
||||
impl MemoryChunkService {
|
||||
pub fn new() -> Self {
|
||||
let db = Arc::new(RwLock::new(HashMap::default()));
|
||||
|
||||
Self { db }
|
||||
}
|
||||
}
|
||||
|
||||
impl ChunkService for MemoryChunkService {
|
||||
#[instrument(skip(self, digest), fields(chunk.digest=BASE64.encode(digest)))]
|
||||
fn has(&self, digest: &[u8]) -> Result<bool, Error> {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue