pub struct ColdTier { /* private fields */ }Expand description
The local cold tier: segment files in one directory beside the database,
opened with keys from an ArchiveKeys. Manifests live in the store; this
caches their parsed form, which never changes once written.
Implementations§
Source§impl ColdTier
impl ColdTier
pub fn open(dir: impl Into<PathBuf>, keys: Arc<dyn ArchiveKeys>) -> Result<Self>
pub fn dir(&self) -> &Path
Sourcepub fn try_hold_passes(&self) -> Option<MutexGuard<'_, ()>>
pub fn try_hold_passes(&self) -> Option<MutexGuard<'_, ()>>
The pass guard without waiting: None while a cold pass, which can run for minutes, holds it. A guard poisoned by a panicked pass is taken, the way every other lock in the tier is.
Sourcepub fn write_segment(
&self,
records: &[ColdRecord],
) -> Result<Option<(String, String)>>
pub fn write_segment( &self, records: &[ColdRecord], ) -> Result<Option<(String, String)>>
Seals records into a new segment file, durably on disk before this
returns. None when no key is available yet. Returns the segment id and
the manifest JSON the store must keep for it.
Sourcepub fn read(
&self,
segment: &str,
memory: Uuid,
manifest: impl FnOnce() -> Result<Option<String>>,
) -> Result<ColdRecord>
pub fn read( &self, segment: &str, memory: Uuid, manifest: impl FnOnce() -> Result<Option<String>>, ) -> Result<ColdRecord>
The record for memory in segment. manifest loads the stored
manifest JSON when it is not cached. A failure is remembered for
status until the part that failed (the segment’s header or one block)
next reads cleanly.
Sourcepub fn check(
&self,
segment: &str,
manifest: impl FnOnce() -> Result<Option<String>>,
) -> Result<()>
pub fn check( &self, segment: &str, manifest: impl FnOnce() -> Result<Option<String>>, ) -> Result<()>
Opens the segment and unwraps its key without reading any block, to find a segment that would fail before a recall needs it. A clean check clears only header failures, never a bad block’s.
pub fn record_count( &self, segment: &str, manifest: impl FnOnce() -> Result<Option<String>>, ) -> Result<usize>
Sourcepub fn record_ids(
&self,
segment: &str,
manifest: impl FnOnce() -> Result<Option<String>>,
) -> Result<Vec<Uuid>>
pub fn record_ids( &self, segment: &str, manifest: impl FnOnce() -> Result<Option<String>>, ) -> Result<Vec<Uuid>>
Every memory the segment’s manifest lists.
pub fn segment_len(&self, segment: &str) -> Option<u64>
pub fn remove_segment(&self, segment: &str) -> Result<()>
Sourcepub fn files(&self) -> Result<(Vec<String>, Vec<PathBuf>)>
pub fn files(&self) -> Result<(Vec<String>, Vec<PathBuf>)>
Segment ids with a file in the directory, and leftover temporary files from a write that never finished.
Sourcepub fn unreadable(&self) -> Vec<UnreadableSegment>
pub fn unreadable(&self) -> Vec<UnreadableSegment>
One entry per segment, with its header failure if it has one.
Auto Trait Implementations§
impl !Freeze for ColdTier
impl !RefUnwindSafe for ColdTier
impl !UnwindSafe for ColdTier
impl Forget for ColdTier
impl Move for ColdTier
impl Send for ColdTier
impl Sync for ColdTier
impl Unpin for ColdTier
impl UnsafeUnpin for ColdTier
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
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>, which can then be
downcast into Box<dyn ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>, which can then be further
downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.Source§impl<T> DowncastSend for T
impl<T> DowncastSend for T
Source§impl<T> DowncastSync for T
impl<T> DowncastSync for T
impl<T> Fruit for T
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