Skip to main content

valence_core/
ttl.rs

1//! Table-level TTL policy hooks.
2
3use crate::error::Result;
4use serde::{Deserialize, Serialize};
5
6#[derive(Debug, Clone, Serialize, Deserialize)]
7pub struct SchemaTtlPolicy {
8    pub seconds: u64,
9    pub mode: String,
10}
11
12#[derive(Debug, Clone, Copy, PartialEq, Eq)]
13pub enum BackendTtlCapability {
14    SupportedNative,
15    Deferred,
16    Unsupported,
17}
18
19#[async_trait::async_trait]
20pub trait BackendTtlAdapter: Send + Sync {
21    fn capability(&self) -> BackendTtlCapability;
22    async fn apply_table_policy(&self, table: &str, policy: &SchemaTtlPolicy) -> Result<()>;
23}