pub struct QuarantineState {
pub storage_version: u32,
pub entries: BTreeMap<String, QuarantineRecord>,
}Expand description
In-memory view of the quarantine state file. Use QuarantineState::load
to read, QuarantineState::record_attempt / QuarantineState::clear
to mutate, and QuarantineState::save to atomically persist.
Fields§
§storage_version: u32Storage version of the file format itself (not the schema_version inside the keys). Bumped when the on-disk shape changes.
entries: BTreeMap<String, QuarantineRecord>Keyed by QuarantineKey::storage_key() for stable JSON ordering.
Implementations§
Source§impl QuarantineState
impl QuarantineState
Sourcepub const FILENAME: &'static str = "quarantine_state.json"
pub const FILENAME: &'static str = "quarantine_state.json"
Filename used inside data_dir. Stable on disk so external
tooling can locate the state.
pub fn path(data_dir: &Path) -> PathBuf
Sourcepub fn load(data_dir: &Path) -> Self
pub fn load(data_dir: &Path) -> Self
Load the quarantine state from <data_dir>/quarantine_state.json.
Returns an empty state when the file is missing or malformed —
quarantine is best-effort metadata and an unreadable state file
must not block indexing.
Sourcepub fn save(&self, data_dir: &Path) -> Result<()>
pub fn save(&self, data_dir: &Path) -> Result<()>
Atomically write the quarantine state to disk via temp file + rename, so partial writes can never produce a corrupt quarantine_state.json.
Sourcepub fn record_attempt(
&mut self,
key: &QuarantineKey,
reason: impl Into<String>,
now: DateTime<Utc>,
)
pub fn record_attempt( &mut self, key: &QuarantineKey, reason: impl Into<String>, now: DateTime<Utc>, )
Record an attempt that failed irreducibly on key. If the key
already exists, the existing record is updated in place
(last_attempt_at, attempt_count, last_reason) rather than
appended — this is the dedup contract from #243.
Sourcepub fn clear(&mut self, key: &QuarantineKey) -> bool
pub fn clear(&mut self, key: &QuarantineKey) -> bool
Remove a quarantine entry. Called by cass quarantine clear
after the operator has confirmed the underlying issue is
resolved (e.g. a memory bump on the streaming consumer, a
schema fix, or accepting the loss).
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Number of currently-quarantined (conversation_id, schema_version)
keys. This is what cass health and the indexer JSON envelope
surface as quarantined_conversations.
pub fn is_empty(&self) -> bool
Sourcepub fn iter(
&self,
) -> impl Iterator<Item = (QuarantineKey, &QuarantineRecord)> + '_
pub fn iter( &self, ) -> impl Iterator<Item = (QuarantineKey, &QuarantineRecord)> + '_
Iterate over (key, record) pairs in deterministic order.
Trait Implementations§
Source§impl Clone for QuarantineState
impl Clone for QuarantineState
Source§fn clone(&self) -> QuarantineState
fn clone(&self) -> QuarantineState
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for QuarantineState
impl Debug for QuarantineState
Source§impl Default for QuarantineState
impl Default for QuarantineState
Source§impl<'de> Deserialize<'de> for QuarantineState
impl<'de> Deserialize<'de> for QuarantineState
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for QuarantineState
impl RefUnwindSafe for QuarantineState
impl Send for QuarantineState
impl Sync for QuarantineState
impl Unpin for QuarantineState
impl UnsafeUnpin for QuarantineState
impl UnwindSafe for QuarantineState
Blanket Implementations§
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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> 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>. Box<dyn Any> can
then be further downcast into Box<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>. Rc<Any> 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
Source§impl<T> DowncastSync for T
impl<T> DowncastSync 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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, _span: NoopSpan) -> Self
fn instrument(self, _span: NoopSpan) -> Self
Source§fn in_current_span(self) -> Self
fn in_current_span(self) -> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<R, P> ReadPrimitive<R> for P
impl<R, P> ReadPrimitive<R> for P
Source§fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian().