diff options
author | Florian Klink <flokli@flokli.de> | 2023-03-10T11·21+0100 |
---|---|---|
committer | clbot <clbot@tvl.fyi> | 2023-03-10T12·15+0000 |
commit | 6d3f5b7eb47498e991ab0f3cd595170751ab3742 (patch) | |
tree | 23870e5e291b39b4838058417644a9715e209ba4 /tvix/store/src | |
parent | b3d6e70909eaa691d98f75a58e2912e59f3536f7 (diff) |
refactor(tvix/store): impl Default for MemoryBlobService r/5943
Change-Id: I78a4cd86cb364b970e99393579808e773db5ceb2 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8237 Reviewed-by: tazjin <tazjin@tvl.su> Tested-by: BuildkiteCI Autosubmit: flokli <flokli@flokli.de>
Diffstat (limited to 'tvix/store/src')
-rw-r--r-- | tvix/store/src/blobservice/memory.rs | 10 | ||||
-rw-r--r-- | 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 73028f8f3c63..57c86551e4de 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<RwLock<HashMap<Vec<u8>, 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<Option<proto::BlobMeta>, Error> { diff --git a/tvix/store/src/tests/utils.rs b/tvix/store/src/tests/utils.rs index 0a4f5afb76e4..916e6516216c 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 { |