bytecon_data_store/
lib.rs1use std::{error::Error, future::Future};
2
3pub mod implementation;
4
5pub trait DataStore {
9 type Item;
10 type Key;
11
12 fn initialize(&mut self) -> impl Future<Output = Result<(), Box<dyn Error>>> + Send;
13 fn insert(&mut self, item: Self::Item) -> impl Future<Output = Result<Self::Key, Box<dyn Error>>> + Send;
14 fn get(&self, id: &Self::Key) -> impl Future<Output = Result<Self::Item, Box<dyn Error>>> + Send;
15 fn delete(&self, id: &Self::Key) -> impl Future<Output = Result<(), Box<dyn Error>>> + Send;
16 fn list(&self, page_index: u64, page_size: u64, row_offset: u64) -> impl Future<Output = Result<Vec<Self::Key>, Box<dyn Error>>> + Send;
17 fn bulk_insert(&mut self, items: Vec<Self::Item>) -> impl Future<Output = Result<Vec<Self::Key>, Box<dyn Error>>> + Send;
18 fn bulk_get(&self, ids: &Vec<Self::Key>) -> impl Future<Output = Result<Vec<Self::Item>, Box<dyn Error>>> + Send;
19}