From a4f6c4181aa7f975b1c3aad8d3fb30021388e014 Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Wed, 1 Mar 2023 18:55:51 +0100 Subject: feat(tvix/store): add new_temporary for all Sled services This provides a service using /dev/shm, that's deleted once the reference is dropped. Refactor all tests to use these, which allows getting rid of most TempDir usage in the tests. The only place where we still use TempDir is in the importer tests, which work on a filesystem path. Change-Id: I08a950aa774bf9b46d9f5c92edf5efba36053242 Reviewed-on: https://cl.tvl.fyi/c/depot/+/8193 Reviewed-by: raitobezarius Tested-by: BuildkiteCI --- tvix/store/src/pathinfoservice/sled.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tvix/store/src/pathinfoservice') diff --git a/tvix/store/src/pathinfoservice/sled.rs b/tvix/store/src/pathinfoservice/sled.rs index dc3c95b51044..b629d869f0fe 100644 --- a/tvix/store/src/pathinfoservice/sled.rs +++ b/tvix/store/src/pathinfoservice/sled.rs @@ -21,6 +21,13 @@ impl SledPathInfoService { Ok(Self { db }) } + + pub fn new_temporary() -> Result { + let config = sled::Config::default().temporary(true); + let db = config.open()?; + + Ok(Self { db }) + } } impl PathInfoService for SledPathInfoService { -- cgit 1.4.1