diff --git a/bucket_map/src/bucket_map.rs b/bucket_map/src/bucket_map.rs index 4a8b2dbcc..d4b70eb47 100644 --- a/bucket_map/src/bucket_map.rs +++ b/bucket_map/src/bucket_map.rs @@ -31,11 +31,14 @@ pub struct BucketMap { max_buckets_pow2: u8, pub stats: Arc, pub temp_dir: Option, + /// true if dropping self removes all folders. + /// This is primarily for test environments. + pub erase_drives_on_drop: bool, } impl Drop for BucketMap { fn drop(&mut self) { - if self.temp_dir.is_none() { + if self.temp_dir.is_none() && self.erase_drives_on_drop { BucketMap::::erase_previous_drives(&self.drives); } } @@ -103,6 +106,7 @@ impl BucketMap { max_buckets_pow2: log2(config.max_buckets) as u8, stats, temp_dir, + erase_drives_on_drop: true, } }