pub trait PersistenceStore {
// Required methods
fn save(&self, sample: &Sample) -> Result<()>;
fn load(&self, topic: &str) -> Result<Vec<Sample>>;
fn query_range(
&self,
topic: &str,
start_ns: u64,
end_ns: u64,
) -> Result<Vec<Sample>>;
fn apply_retention(&self, topic: &str, keep_count: usize) -> Result<()>;
fn count(&self) -> Result<usize>;
fn clear(&self) -> Result<()>;
// Provided method
fn apply_retention_policy(
&self,
topic: &str,
policy: &RetentionPolicy,
) -> Result<()> { ... }
}Expand description
Persistence store trait
Backend-agnostic interface for storing and retrieving DDS samples.
§Implementations
SqliteStore– Default, zero-dependencyRocksDbStore– High-performance (feature flag)
Required Methods§
Sourcefn query_range(
&self,
topic: &str,
start_ns: u64,
end_ns: u64,
) -> Result<Vec<Sample>>
fn query_range( &self, topic: &str, start_ns: u64, end_ns: u64, ) -> Result<Vec<Sample>>
Query samples within a time range
§Arguments
topic– Topic name (supports wildcards: “State/*”)start_ns– Start timestamp (Unix nanoseconds)end_ns– End timestamp (Unix nanoseconds)
Provided Methods§
Sourcefn apply_retention_policy(
&self,
topic: &str,
policy: &RetentionPolicy,
) -> Result<()>
fn apply_retention_policy( &self, topic: &str, policy: &RetentionPolicy, ) -> Result<()>
Apply retention policy with optional age/size constraints.