hyperloglog/storage/
mod.rs1mod file;
2
3#[cfg(feature = "elasticsearch-storage")]
4mod elasticsearch;
5
6pub use file::FileStorage;
7
8#[cfg(feature = "elasticsearch-storage")]
9pub use elasticsearch::ElasticsearchStorage;
10
11use crate::{HyperLogLog, Result};
12use async_trait::async_trait;
13
14#[async_trait]
16pub trait Storage: Send + Sync {
17 async fn store(&self, key: &str, hll: &HyperLogLog) -> Result<()>;
19
20 async fn load(&self, key: &str) -> Result<HyperLogLog>;
22
23 async fn delete(&self, key: &str) -> Result<()>;
25
26 async fn exists(&self, key: &str) -> Result<bool>;
28
29 async fn list_keys(&self) -> Result<Vec<String>>;
31}