From 53059a1b3ea96f840846551ec6f5316d63c3d54c Mon Sep 17 00:00:00 2001 From: Kirpal Grewal Date: Fri, 29 Nov 2024 21:54:33 +0000 Subject: [PATCH] remove lifetime bound --- nativelink-store/src/filesystem_store.rs | 6 ++--- nativelink-store/src/memory_store.rs | 2 +- nativelink-util/src/store_trait.rs | 28 +++++++----------------- 3 files changed, 12 insertions(+), 24 deletions(-) diff --git a/nativelink-store/src/filesystem_store.rs b/nativelink-store/src/filesystem_store.rs index fc522dec0..ffddbbc42 100644 --- a/nativelink-store/src/filesystem_store.rs +++ b/nativelink-store/src/filesystem_store.rs @@ -440,13 +440,13 @@ pub fn key_from_filename(mut file_name: &str) -> Result, Error> { const SIMULTANEOUS_METADATA_READS: usize = 200; async fn add_files_to_cache( - evicting_map: &EvictingMap, Arc, SystemTime>, + evicting_map: &EvictingMap, SystemTime>, anchor_time: &SystemTime, shared_context: &Arc, block_size: u64, ) -> Result<(), Error> { async fn process_entry( - evicting_map: &EvictingMap, Arc, SystemTime>, + evicting_map: &EvictingMap, SystemTime>, file_name: &str, atime: SystemTime, data_size: u64, @@ -561,7 +561,7 @@ pub struct FilesystemStore { #[metric] shared_context: Arc, #[metric(group = "evicting_map")] - evicting_map: Arc, Arc, SystemTime>>, + evicting_map: Arc, SystemTime>>, #[metric(help = "Block size of the configured filesystem")] block_size: u64, #[metric(help = "Size of the configured read buffer size")] diff --git a/nativelink-store/src/memory_store.rs b/nativelink-store/src/memory_store.rs index e0854c32b..edc5e2dd5 100644 --- a/nativelink-store/src/memory_store.rs +++ b/nativelink-store/src/memory_store.rs @@ -55,7 +55,7 @@ impl LenEntry for BytesWrapper { #[derive(MetricsComponent)] pub struct MemoryStore { #[metric(group = "evicting_map")] - evicting_map: EvictingMap, BytesWrapper, SystemTime>, + evicting_map: EvictingMap, } impl MemoryStore { diff --git a/nativelink-util/src/store_trait.rs b/nativelink-util/src/store_trait.rs index 482b0a298..4f01194b3 100644 --- a/nativelink-util/src/store_trait.rs +++ b/nativelink-util/src/store_trait.rs @@ -151,41 +151,29 @@ pub enum StoreOptimizations { /// As such this is a wrapper type that is stored in the /// maps using the workaround as described in /// -#[derive(Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] +#[derive(Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)] #[repr(transparent)] -pub struct StoreKeyBorrow<'a>(StoreKey<'a>); +pub struct StoreKeyBorrow(StoreKey<'static>); -impl Clone for StoreKeyBorrow<'static> { - fn clone(&self) -> Self { - Self(self.0.clone()) - } -} - -impl<'a> From> for StoreKeyBorrow<'a> { - fn from(key: StoreKey<'a>) -> Self { +impl From> for StoreKeyBorrow { + fn from(key: StoreKey<'static>) -> Self { Self(key) } } -impl<'a> From> for StoreKey<'a> { - fn from(key_borrow: StoreKeyBorrow<'a>) -> Self { +impl From for StoreKey<'static> { + fn from(key_borrow: StoreKeyBorrow) -> Self { key_borrow.0 } } -impl<'a, 'b> Borrow> for StoreKeyBorrow<'b> -where - 'b: 'a, -{ +impl<'a> Borrow> for StoreKeyBorrow { fn borrow(&self) -> &StoreKey<'a> { &self.0 } } -impl<'a, 'b> Borrow> for &StoreKeyBorrow<'b> -where - 'b: 'a, -{ +impl<'a> Borrow> for &StoreKeyBorrow { fn borrow(&self) -> &StoreKey<'a> { &self.0 }