From b3d6e70909eaa691d98f75a58e2912e59f3536f7 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 10 Mar 2023 12:21:12 +0100 Subject: refactor(tvix/store): impl Default for MemoryChunkService Change-Id: If1ceb870e9e5d03b651923a3a786350a8663e990 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8236 Autosubmit: flokli Tested-by: BuildkiteCI Reviewed-by: tazjin --- tvix/store/src/chunkservice/memory.rs | 10 +--------- tvix/store/src/tests/utils.rs | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) (limited to 'tvix') diff --git a/tvix/store/src/chunkservice/memory.rs b/tvix/store/src/chunkservice/memory.rs index 1ae8b9130565..8364e434461f 100644 --- a/tvix/store/src/chunkservice/memory.rs +++ b/tvix/store/src/chunkservice/memory.rs @@ -9,19 +9,11 @@ use crate::Error; use super::ChunkService; -#[derive(Clone)] +#[derive(Clone, Default)] pub struct MemoryChunkService { db: Arc, Vec>>>, } -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 { diff --git a/tvix/store/src/tests/utils.rs b/tvix/store/src/tests/utils.rs index 6cf888c9d666..0a4f5afb76e4 100644 --- a/tvix/store/src/tests/utils.rs +++ b/tvix/store/src/tests/utils.rs @@ -10,7 +10,7 @@ pub fn gen_blob_service() -> impl BlobService + Send + Sync + Clone + 'static { } pub fn gen_chunk_service() -> impl ChunkService + Clone { - MemoryChunkService::new() + MemoryChunkService::default() } pub fn gen_directory_service() -> impl DirectoryService + Send + Sync + Clone + 'static { -- cgit 1.4.1