1use crate::{BinPtr, EventId, Importance, Object, ObjectId, Updatedness};
2use std::sync::Arc;
3
4pub trait Db: 'static + waaaa::Send + waaaa::Sync {
7 fn create<T: Object>(
12 &self,
13 object_id: ObjectId,
14 created_at: EventId,
15 object: Arc<T>,
16 updatedness: Option<Updatedness>,
17 additional_importance: Importance,
18 ) -> impl waaaa::Future<Output = crate::Result<Option<Arc<T>>>>;
19
20 fn submit<T: Object>(
25 &self,
26 object_id: ObjectId,
27 event_id: EventId,
28 event: Arc<T::Event>,
29 updatedness: Option<Updatedness>,
30 additional_importance: Importance,
31 ) -> impl waaaa::Future<Output = crate::Result<Option<Arc<T>>>>;
32
33 fn get_latest<T: Object>(
34 &self,
35 object_id: ObjectId,
36 importance: Importance,
37 ) -> impl waaaa::Future<Output = crate::Result<Arc<T>>>;
38
39 fn create_binary(
40 &self,
41 binary_id: BinPtr,
42 data: Arc<[u8]>,
43 ) -> impl waaaa::Future<Output = crate::Result<()>>;
44
45 fn get_binary(
46 &self,
47 binary_id: BinPtr,
48 ) -> impl waaaa::Future<Output = crate::Result<Option<Arc<[u8]>>>>;
49
50 fn reencode_old_versions<T: Object>(&self) -> impl waaaa::Future<Output = usize>;
52
53 fn assert_invariants_generic(&self) -> impl waaaa::Future<Output = ()>;
54 fn assert_invariants_for<T: Object>(&self) -> impl waaaa::Future<Output = ()>;
55}