agy_bridge/runtime/
config.rs1use std::time::Duration;
4
5use super::{DEFAULT_CHANNEL_CAPACITY, DEFAULT_INTER_AGENT_DELAY, DEFAULT_SHUTDOWN_TIMEOUT};
6
7#[derive(Debug, Default, Clone, Copy, PartialEq, Eq, serde::Serialize, serde::Deserialize)]
13#[serde(rename_all = "lowercase")]
14pub enum BackendLogLevel {
15 Error,
17 #[default]
19 Warn,
20 Info,
22 Debug,
24}
25
26impl BackendLogLevel {
27 #[must_use]
29 pub fn as_str(self) -> &'static str {
30 match self {
31 Self::Error => "error",
32 Self::Warn => "warn",
33 Self::Info => "info",
34 Self::Debug => "debug",
35 }
36 }
37}
38
39impl std::fmt::Display for BackendLogLevel {
40 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
41 f.write_str(self.as_str())
42 }
43}
44
45#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
47#[serde(default)]
48pub struct RuntimeConfig {
49 pub channel_capacity: usize,
51 pub shutdown_timeout: Duration,
53 pub inter_agent_delay: Duration,
55 pub backend_log_level: BackendLogLevel,
60}
61
62impl Default for RuntimeConfig {
63 fn default() -> Self {
64 Self {
65 channel_capacity: DEFAULT_CHANNEL_CAPACITY,
66 shutdown_timeout: DEFAULT_SHUTDOWN_TIMEOUT,
67 inter_agent_delay: DEFAULT_INTER_AGENT_DELAY,
68 backend_log_level: BackendLogLevel::default(),
69 }
70 }
71}