From 04531e77dd1f57188b1a4045fb8cd713b265496a Mon Sep 17 00:00:00 2001 From: "Carol (Nichols || Goulding)" Date: Wed, 25 May 2022 15:22:37 -0400 Subject: [PATCH] feat: Implement get on ReadBufferCache --- querier/src/cache/read_buffer.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/querier/src/cache/read_buffer.rs b/querier/src/cache/read_buffer.rs index 6c2b965856..db624a69ae 100644 --- a/querier/src/cache/read_buffer.rs +++ b/querier/src/cache/read_buffer.rs @@ -20,7 +20,7 @@ const CACHE_ID: &str = "read_buffer"; /// Cache for parquet file data decoded into read buffer chunks #[derive(Debug)] pub struct ReadBufferCache { - _cache: Cache>, + cache: Cache>, /// Handle that allows clearing entries for existing cache entries _backend: SharedBackend>, @@ -61,9 +61,14 @@ impl ReadBufferCache { // get a direct handle so we can clear out entries as needed let _backend = SharedBackend::new(backend); - let _cache = Cache::new(loader, Box::new(_backend.clone())); + let cache = Cache::new(loader, Box::new(_backend.clone())); - Self { _cache, _backend } + Self { cache, _backend } + } + + /// Get read buffer chunks by Parquet file id + pub async fn get(&self, parquet_file_id: ParquetFileId) -> Arc { + self.cache.get(parquet_file_id).await } }