pub struct MetadataCache { /* private fields */ }Expand description
In-memory metadata cache for all segments.
Populated on startup from the segment catalog and updated as segments are created, compacted, or deleted.
§Thread Safety
Uses RwLock<HashMap> for concurrent read access.
§Capacity bound
An optional max_entries limit caps the number of cached segments.
When the limit is reached, new inserts are still accepted (to keep
hot metadata available) but a warning is emitted so operators can
investigate. Each entry is ~1 KB, so even the default cap of
500 000 entries consumes at most ~500 MB — a safe upper bound for
most deployments. Set max_entries = 0 to disable the cap.
Implementations§
Source§impl MetadataCache
impl MetadataCache
Sourcepub fn with_max_entries(max_entries: usize) -> Self
pub fn with_max_entries(max_entries: usize) -> Self
Create an empty metadata cache with a custom capacity bound.
Pass 0 to disable the capacity warning.
Sourcepub fn insert(&self, meta: CachedSegmentMeta)
pub fn insert(&self, meta: CachedSegmentMeta)
Insert or update metadata for a segment.
If the cache exceeds max_entries a
warning is logged but the insert still succeeds so that hot
metadata is never silently dropped.
Sourcepub fn get(&self, segment_id: SegmentId) -> Option<Arc<CachedSegmentMeta>>
pub fn get(&self, segment_id: SegmentId) -> Option<Arc<CachedSegmentMeta>>
Look up metadata for a segment.
Returns an Arc for cheap cloning.
Sourcepub fn columns_for(&self, segment_id: SegmentId) -> Option<Vec<ColumnMeta>>
pub fn columns_for(&self, segment_id: SegmentId) -> Option<Vec<ColumnMeta>>
Returns column metadata for a segment, if cached.
Trait Implementations§
Source§impl Debug for MetadataCache
impl Debug for MetadataCache
Auto Trait Implementations§
impl !RefUnwindSafe for MetadataCache
impl !UnwindSafe for MetadataCache
impl Freeze for MetadataCache
impl Send for MetadataCache
impl Sync for MetadataCache
impl Unpin for MetadataCache
impl UnsafeUnpin for MetadataCache
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more