pub struct SilenceStore { /* private fields */ }Expand description
The runtime silence set, owned single-threaded by the sink task and shared
behind an RwLock so the silence API can mutate it.
Implementations§
Source§impl SilenceStore
impl SilenceStore
Sourcepub fn add(&mut self, silence: Silence)
pub fn add(&mut self, silence: Silence)
Add a silence (used by restore and tests). Prefer try_add on the API
path so the dynamic-silence cap is enforced.
Sourcepub fn dynamic_count(&self) -> usize
pub fn dynamic_count(&self) -> usize
Count of dynamic (API-origin) silences currently tracked.
Sourcepub fn try_add(&mut self, silence: Silence, max_dynamic: usize) -> bool
pub fn try_add(&mut self, silence: Silence, max_dynamic: usize) -> bool
Add an API-origin silence unless the dynamic-silence cap is reached.
Returns false (and does not add) when at or over max_dynamic.
Sourcepub fn remove(&mut self, id: &str) -> bool
pub fn remove(&mut self, id: &str) -> bool
Remove a silence by id. Returns whether one was removed.
Sourcepub fn set_static(&mut self, statics: Vec<Silence>)
pub fn set_static(&mut self, statics: Vec<Silence>)
Replace all static-origin silences with statics, keeping api ones.
Used on config load and hot-reload.
Sourcepub fn active_match(&self, result: &EvaluationResult, now: i64) -> Option<&str>
pub fn active_match(&self, result: &EvaluationResult, now: i64) -> Option<&str>
The id of the first active silence muting the result, if any.
Sourcepub fn active_count(&self, now: i64) -> usize
pub fn active_count(&self, now: i64) -> usize
Count of currently-active silences.
Sourcepub fn snapshot(&self, now: i64) -> Vec<SilenceView>
pub fn snapshot(&self, now: i64) -> Vec<SilenceView>
A snapshot of every silence for the API.
Trait Implementations§
Source§impl Debug for SilenceStore
impl Debug for SilenceStore
Source§impl Default for SilenceStore
impl Default for SilenceStore
Source§fn default() -> SilenceStore
fn default() -> SilenceStore
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SilenceStore
impl RefUnwindSafe for SilenceStore
impl Send for SilenceStore
impl Sync for SilenceStore
impl Unpin for SilenceStore
impl UnsafeUnpin for SilenceStore
impl UnwindSafe for SilenceStore
Blanket Implementations§
Source§impl<T> AnyExt for T
impl<T> AnyExt for T
Source§fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
fn downcast_ref<T>(this: &Self) -> Option<&T>where
T: Any,
Attempts to downcast this to
T behind referenceSource§fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
fn downcast_mut<T>(this: &mut Self) -> Option<&mut T>where
T: Any,
Attempts to downcast this to
T behind mutable referenceSource§fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
fn downcast_rc<T>(this: Rc<Self>) -> Result<Rc<T>, Rc<Self>>where
T: Any,
Attempts to downcast this to
T behind Rc pointerSource§fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
fn downcast_arc<T>(this: Arc<Self>) -> Result<Arc<T>, Arc<Self>>where
T: Any,
Attempts to downcast this to
T behind Arc pointerSource§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
Mutably borrows from an owned value. Read more
Source§impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
impl<T, X> CoerceTo<T> for Xwhere
T: CoerceFrom<X> + ?Sized,
fn coerce_rc_to(self: Rc<X>) -> Rc<T>
fn coerce_box_to(self: Box<X>) -> Box<T>
fn coerce_ref_to(&self) -> &T
fn coerce_mut_to(&mut self) -> &mut 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>
Converts
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>
Converts
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