pub struct MetricsPersistence { /* private fields */ }
Expand description
Metrics persistence manager
Implementations§
Source§impl MetricsPersistence
impl MetricsPersistence
Sourcepub fn new(config: PersistenceConfig) -> Result<Self, Error>
pub fn new(config: PersistenceConfig) -> Result<Self, Error>
Create a new metrics persistence manager
Sourcepub async fn save_snapshot(
&self,
snapshot: MetricsSnapshot,
) -> Result<(), Error>
pub async fn save_snapshot( &self, snapshot: MetricsSnapshot, ) -> Result<(), Error>
Save a metrics snapshot
Sourcepub async fn load_range(
&self,
start: DateTime<Utc>,
end: DateTime<Utc>,
) -> Result<Vec<PersistedMetrics>, Error>
pub async fn load_range( &self, start: DateTime<Utc>, end: DateTime<Utc>, ) -> Result<Vec<PersistedMetrics>, Error>
Load metrics from a time range
Sourcepub async fn load_latest(&self) -> Result<Option<MetricsSnapshot>, Error>
pub async fn load_latest(&self) -> Result<Option<MetricsSnapshot>, Error>
Load the most recent metrics snapshot
Auto Trait Implementations§
impl Freeze for MetricsPersistence
impl !RefUnwindSafe for MetricsPersistence
impl Send for MetricsPersistence
impl Sync for MetricsPersistence
impl Unpin for MetricsPersistence
impl !UnwindSafe for MetricsPersistence
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more