about summary refs log tree commit diff
path: root/tvix/store
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2023-03-10T11·20+0100
committerclbot <clbot@tvl.fyi>2023-03-10T12·13+0000
commite716bd09579208f17c016bb265fc92bacc1b1216 (patch)
treec1823227e9632a6f266488dfe11d3f43a68ac2e5 /tvix/store
parent8e97c0deb056dfe29feff9aefcc524c0f2f36355 (diff)
refactor(tvix/store): impl Default for MemoryDirectoryService r/5941
Change-Id: Ie75a1e67c8c0499ff10f60d90251b768937dad3a
Reviewed-on: https://cl.tvl.fyi/c/depot/+/8235
Reviewed-by: tazjin <tazjin@tvl.su>
Tested-by: BuildkiteCI
Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/store')
-rw-r--r--tvix/store/src/directoryservice/memory.rs10
-rw-r--r--tvix/store/src/tests/utils.rs2
2 files changed, 2 insertions, 10 deletions
diff --git a/tvix/store/src/directoryservice/memory.rs b/tvix/store/src/directoryservice/memory.rs
index 34ee45203320..87cd038888e6 100644
--- a/tvix/store/src/directoryservice/memory.rs
+++ b/tvix/store/src/directoryservice/memory.rs
@@ -6,19 +6,11 @@ use tracing::{instrument, warn};
 
 use super::DirectoryService;
 
-#[derive(Clone)]
+#[derive(Clone, Default)]
 pub struct MemoryDirectoryService {
     db: Arc<RwLock<HashMap<Vec<u8>, proto::Directory>>>,
 }
 
-impl MemoryDirectoryService {
-    pub fn new() -> Self {
-        let db = Arc::new(RwLock::new(HashMap::default()));
-
-        Self { db }
-    }
-}
-
 impl DirectoryService for MemoryDirectoryService {
     // TODO: change api to only be by digest
     #[instrument(skip(self, by_what))]
diff --git a/tvix/store/src/tests/utils.rs b/tvix/store/src/tests/utils.rs
index 0b4a85a3af65..6cf888c9d666 100644
--- a/tvix/store/src/tests/utils.rs
+++ b/tvix/store/src/tests/utils.rs
@@ -14,7 +14,7 @@ pub fn gen_chunk_service() -> impl ChunkService + Clone {
 }
 
 pub fn gen_directory_service() -> impl DirectoryService + Send + Sync + Clone + 'static {
-    MemoryDirectoryService::new()
+    MemoryDirectoryService::default()
 }
 
 pub fn gen_pathinfo_service() -> impl PathInfoService {