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.
§Size
One entry per live segment, and memory_bytes
reports what they cost. The figure is maintained as entries are inserted
and removed rather than recomputed, because statistics() runs on every
metrics scrape and walking the map there would make the exporter the most
expensive thing in the process.
Implementations§
Source§impl MetadataCache
impl MetadataCache
Sourcepub fn insert(&self, meta: CachedSegmentMeta)
pub fn insert(&self, meta: CachedSegmentMeta)
Insert or update metadata for a segment.
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 memory_bytes(&self) -> usize
pub fn memory_bytes(&self) -> usize
Bytes the index holds, counted as entries come and go.
Summed into the database’s resident-memory total and exported as
chronix_metadata_cache_bytes.
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