spatio_types/
config.rs

1use serde::{Deserialize, Serialize};
2use std::time::SystemTime;
3
4/// Synchronization policy for persistence.
5#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
6#[serde(rename_all = "snake_case")]
7pub enum SyncPolicy {
8    Never,
9    #[default]
10    EverySecond,
11    Always,
12}
13
14/// File synchronization strategy (fsync vs fdatasync).
15#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize, Default)]
16#[serde(rename_all = "snake_case")]
17pub enum SyncMode {
18    #[default]
19    All,
20    Data,
21}
22
23/// Options for setting values.
24#[derive(Debug, Clone, Default, Serialize, Deserialize)]
25pub struct SetOptions {
26    /// Optional timestamp for the update (defaults to now if None)
27    pub timestamp: Option<SystemTime>,
28}
29
30impl SetOptions {
31    pub fn with_timestamp(timestamp: SystemTime) -> Self {
32        Self {
33            timestamp: Some(timestamp),
34        }
35    }
36}