From 6d3f5b7eb47498e991ab0f3cd595170751ab3742 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Fri, 10 Mar 2023 12:21:52 +0100 Subject: [PATCH] refactor(tvix/store): impl Default for MemoryBlobService Change-Id: I78a4cd86cb364b970e99393579808e773db5ceb2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8237 Reviewed-by: tazjin Tested-by: BuildkiteCI Autosubmit: flokli --- tvix/store/src/blobservice/memory.rs | 10 +--------- tvix/store/src/tests/utils.rs | 2 +- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/tvix/store/src/blobservice/memory.rs b/tvix/store/src/blobservice/memory.rs index 73028f8f3..57c86551e 100644 --- a/tvix/store/src/blobservice/memory.rs +++ b/tvix/store/src/blobservice/memory.rs @@ -9,19 +9,11 @@ use crate::{proto, Error}; use super::BlobService; -#[derive(Clone)] +#[derive(Clone, Default)] pub struct MemoryBlobService { db: Arc, proto::BlobMeta>>>, } -impl MemoryBlobService { - pub fn new() -> Self { - let db = Arc::new(RwLock::new(HashMap::default())); - - Self { db } - } -} - impl BlobService for MemoryBlobService { #[instrument(skip(self, req), fields(blob.digest=BASE64.encode(&req.digest)))] fn stat(&self, req: &proto::StatBlobRequest) -> Result, Error> { diff --git a/tvix/store/src/tests/utils.rs b/tvix/store/src/tests/utils.rs index 0a4f5afb7..916e65162 100644 --- a/tvix/store/src/tests/utils.rs +++ b/tvix/store/src/tests/utils.rs @@ -6,7 +6,7 @@ use crate::{ }; pub fn gen_blob_service() -> impl BlobService + Send + Sync + Clone + 'static { - MemoryBlobService::new() + MemoryBlobService::default() } pub fn gen_chunk_service() -> impl ChunkService + Clone {