pub trait RecordStore:
Send
+ Sync
+ 'static {
// Required methods
fn upsert_record<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
collection: &'life1 str,
key: &'life2 str,
value: T,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where T: Serialize + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn get_ordered_records<'life0, 'life1, 'async_trait, T>(
&'life0 self,
collection: &'life1 str,
limit: Option<usize>,
order: SortOrder,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, T)>, String>> + Send + 'async_trait>>
where T: DeserializeOwned + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn delete_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
fn trim_records_before<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
cutoff_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}Required Methods§
Sourcefn upsert_record<'life0, 'life1, 'life2, 'async_trait, T>(
&'life0 self,
collection: &'life1 str,
key: &'life2 str,
value: T,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
fn upsert_record<'life0, 'life1, 'life2, 'async_trait, T>( &'life0 self, collection: &'life1 str, key: &'life2 str, value: T, ) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>
Inserts or updates an individual record. If the key is a Timestamp or ULID, time-based ordering is natively maintained.
Sourcefn get_ordered_records<'life0, 'life1, 'async_trait, T>(
&'life0 self,
collection: &'life1 str,
limit: Option<usize>,
order: SortOrder,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, T)>, String>> + Send + 'async_trait>>where
T: DeserializeOwned + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn get_ordered_records<'life0, 'life1, 'async_trait, T>(
&'life0 self,
collection: &'life1 str,
limit: Option<usize>,
order: SortOrder,
) -> Pin<Box<dyn Future<Output = Result<Vec<(String, T)>, String>> + Send + 'async_trait>>where
T: DeserializeOwned + Send + Sync + 'static + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Retrieves records guaranteed to be sorted by their key. Allows pagination to avoid loading the entire history into RAM.
Sourcefn delete_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn delete_record<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Deletes a specific record.
Sourcefn trim_records_before<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
cutoff_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn trim_records_before<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
collection: &'life1 str,
cutoff_key: &'life2 str,
) -> Pin<Box<dyn Future<Output = Result<(), String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Atomically deletes all records with a key smaller than cutoff_key.
This natively delegates sliding-window “VecDeque::pop_front()” operations to the DB.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".