pub trait LogStore: Send + Sync {
// Required methods
fn append(&self, daemon_id: &DaemonId, message: &str) -> Result<()>;
fn query(&self, opts: &LogQuery) -> Result<Vec<LogEntry>>;
fn tail(
&self,
daemon_id: &DaemonId,
after_id: Option<i64>,
) -> Result<Vec<LogEntry>>;
fn clear(&self, daemon_ids: &[DaemonId]) -> Result<()>;
fn list_daemon_ids(&self) -> Result<Vec<String>>;
// Provided methods
fn apply_retention(
&self,
policy: &RetentionPolicy,
excluded_daemon_ids: &[DaemonId],
) -> Result<u64> { ... }
fn apply_retention_for_daemon(
&self,
daemon_id: &DaemonId,
policy: &RetentionPolicy,
) -> Result<u64> { ... }
fn last_clear_generation(&self, daemon_id: &DaemonId) -> Result<Option<u64>> { ... }
}Expand description
Unified interface for log storage and retrieval.
Required Methods§
Sourcefn query(&self, opts: &LogQuery) -> Result<Vec<LogEntry>>
fn query(&self, opts: &LogQuery) -> Result<Vec<LogEntry>>
Query logs according to the given options.
Sourcefn tail(
&self,
daemon_id: &DaemonId,
after_id: Option<i64>,
) -> Result<Vec<LogEntry>>
fn tail( &self, daemon_id: &DaemonId, after_id: Option<i64>, ) -> Result<Vec<LogEntry>>
Read new log entries for a daemon.
When after_id is Some(id), returns only entries with row id > id.
When after_id is None, returns all entries for the daemon.
Sourcefn list_daemon_ids(&self) -> Result<Vec<String>>
fn list_daemon_ids(&self) -> Result<Vec<String>>
List all daemon IDs that have log entries.
Provided Methods§
Sourcefn apply_retention(
&self,
policy: &RetentionPolicy,
excluded_daemon_ids: &[DaemonId],
) -> Result<u64>
fn apply_retention( &self, policy: &RetentionPolicy, excluded_daemon_ids: &[DaemonId], ) -> Result<u64>
Apply a retention policy (age-based and/or count-based pruning).
By default this applies to all daemons; excluded_daemon_ids can be
used to skip daemons that have their own per-daemon overrides, so the
global policy does not accidentally prune entries those daemons intend
to keep.
Sourcefn apply_retention_for_daemon(
&self,
daemon_id: &DaemonId,
policy: &RetentionPolicy,
) -> Result<u64>
fn apply_retention_for_daemon( &self, daemon_id: &DaemonId, policy: &RetentionPolicy, ) -> Result<u64>
Apply a retention policy to a specific daemon’s logs.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".