From 28a862976bd43912e0e5dc16e8919590c36f4cf0 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Mon, 27 Feb 2023 08:59:45 +0100 Subject: refactor(tvix/store/tests): move gen_*_service() into helper This allows hiding to tests what exact implementation we're using, when testing things that do something with a store, but don't care what's used for underlying storage. Change-Id: I7cdf60fd73c25d5050159cb31ec177db2bc2a7f1 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8155 Tested-by: BuildkiteCI Reviewed-by: raitobezarius --- tvix/store/src/tests/utils.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 tvix/store/src/tests/utils.rs (limited to 'tvix/store/src/tests/utils.rs') diff --git a/tvix/store/src/tests/utils.rs b/tvix/store/src/tests/utils.rs new file mode 100644 index 000000000000..4ddd4102fb97 --- /dev/null +++ b/tvix/store/src/tests/utils.rs @@ -0,0 +1,24 @@ +use std::path::Path; + +use crate::{ + blobservice::{BlobService, SledBlobService}, + chunkservice::{ChunkService, SledChunkService}, + directoryservice::{DirectoryService, SledDirectoryService}, + pathinfoservice::{PathInfoService, SledPathInfoService}, +}; + +pub fn gen_blob_service(p: &Path) -> impl BlobService + Send + Sync + Clone + 'static { + SledBlobService::new(p.join("blobs")).unwrap() +} + +pub fn gen_chunk_service(p: &Path) -> impl ChunkService + Clone { + SledChunkService::new(p.join("chunks")).unwrap() +} + +pub fn gen_directory_service(p: &Path) -> impl DirectoryService + Send + Sync + Clone + 'static { + SledDirectoryService::new(p.join("directories")).unwrap() +} + +pub fn gen_pathinfo_service(p: &Path) -> impl PathInfoService { + SledPathInfoService::new(p.join("pathinfo")).unwrap() +} -- cgit 1.4.1