ralph/contracts/config/
loop_.rs1use schemars::JsonSchema;
10use serde::{Deserialize, Serialize};
11
12#[derive(Debug, Clone, Serialize, Deserialize, Default, JsonSchema)]
14#[serde(default, deny_unknown_fields)]
15pub struct LoopConfig {
16 pub wait_when_empty: Option<bool>,
18
19 #[schemars(range(min = 50))]
22 pub empty_poll_ms: Option<u64>,
23
24 pub wait_when_blocked: Option<bool>,
26
27 #[schemars(range(min = 50))]
30 pub wait_poll_ms: Option<u64>,
31
32 #[schemars(range(min = 0))]
34 pub wait_timeout_seconds: Option<u64>,
35
36 pub notify_when_unblocked: Option<bool>,
38}
39
40impl LoopConfig {
41 pub fn merge_from(&mut self, other: Self) {
42 if other.wait_when_empty.is_some() {
43 self.wait_when_empty = other.wait_when_empty;
44 }
45 if other.empty_poll_ms.is_some() {
46 self.empty_poll_ms = other.empty_poll_ms;
47 }
48 if other.wait_when_blocked.is_some() {
49 self.wait_when_blocked = other.wait_when_blocked;
50 }
51 if other.wait_poll_ms.is_some() {
52 self.wait_poll_ms = other.wait_poll_ms;
53 }
54 if other.wait_timeout_seconds.is_some() {
55 self.wait_timeout_seconds = other.wait_timeout_seconds;
56 }
57 if other.notify_when_unblocked.is_some() {
58 self.notify_when_unblocked = other.notify_when_unblocked;
59 }
60 }
61}