aquarium_control/dispatch/messaging_config.rs
1/* Copyright 2025 Uwe Martin
2
3Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
4
5The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
6
7THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
8*/
9//! Defines the configuration structure for the Inter-Process Communication (IPC) messaging system.
10//!
11//! This module contains the `MessagingConfig` struct, which is used with `serde` to
12//! deserialize the `[messaging]` section from the application's TOML configuration file.
13//! It holds parameters that control the behavior of the POSIX message queue listener.
14//!
15//! This entire module is conditionally compiled and is only available on `target_os = "linux"`
16//! (or during tests), as it is part of the POSIX-based IPC mechanism.
17
18#[cfg(target_os = "linux")]
19use serde_derive::Deserialize;
20
21#[cfg(target_os = "linux")]
22/// Holds the configuration data for the messaging.
23/// The configuration is loaded from the .toml configuration file.
24/// This struct does not contain any implementation.
25#[derive(Deserialize)]
26pub struct MessagingConfig {
27 /// filename used for generating the message queue identifier
28 pub mq_filename: String,
29
30 /// timeout for receiving messages in milliseconds
31 /// after each timeout, the application checks if a shutdown has been requested
32 pub timeout_millis: u64,
33}