pub struct MemoryChecker { /* private fields */ }
Expand description
Struct that composes a Config
and MemoryStat
and provides utility methods to validate
whether memory is within limits.
The rationale behind such struct, is to be able to share across Relay the same logic for dealing
with memory readings. It’s decoupled from MemoryStat
because it’s just a layer on top that
decides how memory readings are interpreted.
Implementations§
source§impl MemoryChecker
impl MemoryChecker
sourcepub fn new(memory_stat: MemoryStat, config: Arc<Config>) -> Self
pub fn new(memory_stat: MemoryStat, config: Arc<Config>) -> Self
Create an instance of MemoryChecker
.
sourcepub fn check_memory_percent(&self) -> MemoryCheck
pub fn check_memory_percent(&self) -> MemoryCheck
Checks if the used percentage of memory is below the specified threshold.
sourcepub fn check_memory_bytes(&self) -> MemoryCheck
pub fn check_memory_bytes(&self) -> MemoryCheck
Checks if the used memory (in bytes) is below the specified threshold.
sourcepub fn check_memory(&self) -> MemoryCheck
pub fn check_memory(&self) -> MemoryCheck
Checks if the used memory is below both percentage and bytes thresholds.
This is the function that should be mainly used for checking whether of not Relay has enough memory.
Trait Implementations§
source§impl Clone for MemoryChecker
impl Clone for MemoryChecker
source§fn clone(&self) -> MemoryChecker
fn clone(&self) -> MemoryChecker
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreAuto Trait Implementations§
impl Freeze for MemoryChecker
impl RefUnwindSafe for MemoryChecker
impl Send for MemoryChecker
impl Sync for MemoryChecker
impl Unpin for MemoryChecker
impl UnwindSafe for MemoryChecker
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
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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 moresource§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T
in a tonic::Request