pub struct Memory {
config: MemoryConfig,
}Expand description
The main struct for the memory monitoring thread.
An instance of this struct contains the configuration and the state required to perform periodic memory checks.
Fields§
§config: MemoryConfigconfiguration read from .toml file
Implementations§
Source§impl Memory
impl Memory
Sourcepub fn new(config: MemoryConfig) -> Result<Memory, MemoryConfigError>
pub fn new(config: MemoryConfig) -> Result<Memory, MemoryConfigError>
Sourcepub fn execute(&mut self, memory_channels: &mut MemoryChannels)
pub fn execute(&mut self, memory_channels: &mut MemoryChannels)
Starts the memory monitoring loop.
- Checks for a
Quitcommand from the signal handler to terminate gracefully. - Checks the current resident and allocated memory usage against configured limits.
- Logs a warning if any limit is exceeded.
- Sleeps for the configured interval before the next check.
§Arguments
memory_channels- A mutable reference to the channels used for receiving shutdown commands.
Trait Implementations§
Source§impl ProcessExternalRequestTrait for Memory
impl ProcessExternalRequestTrait for Memory
Source§fn process_external_request(
&mut self,
rx_from_signal_handler: &mut AquaReceiver<InternalCommand>,
_: Option<&mut AquaReceiver<InternalCommand>>,
) -> (bool, bool, bool)
fn process_external_request( &mut self, rx_from_signal_handler: &mut AquaReceiver<InternalCommand>, _: Option<&mut AquaReceiver<InternalCommand>>, ) -> (bool, bool, bool)
Checks for and processes new commands relevant to the Memory module from external channels.
This is the specialized implementation of ProcessExternalRequestTrait for TcpCommunication.
It delegates directly to process_external_request_without_messaging, indicating
that the Memory module primarily processes commands from the signal handler
and does not use a separate messaging channel for external requests.
§Arguments
rx_from_memory- A reference to the receiver end of the channel for commands originating from the signal handler._- This parameter is ignored, as theMemorymodule does not process messages from a messaging channel in this context.
§Returns
A tuple (bool, bool, bool) indicating the status of commands received:
- The first
boolistrueif aQuitcommand was received; otherwisefalse. - The second
boolis alwaysfalse(no “Start” commands processed). - The third
boolis alwaysfalse(no “Stop” commands processed).
Auto Trait Implementations§
impl Freeze for Memory
impl RefUnwindSafe for Memory
impl Send for Memory
impl Sync for Memory
impl Unpin for Memory
impl UnwindSafe for Memory
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