saluki_config/dynamic/event.rs
1//! Defines the event type for configuration changes.
2
3use serde_json::Value as JsonValue;
4
5/// An event that occurs when the configuration changes.
6#[derive(Debug, Clone, PartialEq, Eq)]
7pub struct ConfigChangeEvent {
8 /// The key that changed.
9 pub key: String,
10 /// The previous value, if any.
11 pub old_value: Option<JsonValue>,
12 /// The new value.
13 pub new_value: Option<JsonValue>,
14}
15
16/// An update message for the dynamic configuration state, sent from the config stream to the updater task.
17#[derive(Clone, Debug)]
18pub enum ConfigUpdate {
19 /// A complete snapshot of the configuration.
20 ///
21 /// The existing state should be replaced.
22 Snapshot(serde_json::Value),
23 /// A partial update for a single key-value pair.
24 ///
25 /// This should be merged into the existing state.
26 Partial {
27 /// The key to update.
28 key: String,
29 /// The new value.
30 value: serde_json::Value,
31 },
32}