pub trait Db:
'static
+ Send
+ Sync {
// Required methods
fn create<T: Object>(
&self,
object_id: ObjectId,
created_at: EventId,
object: Arc<T>,
updatedness: Option<Updatedness>,
additional_importance: Importance,
) -> impl Future<Output = Result<Option<Arc<T>>>>;
fn submit<T: Object>(
&self,
object_id: ObjectId,
event_id: EventId,
event: Arc<T::Event>,
updatedness: Option<Updatedness>,
additional_importance: Importance,
) -> impl Future<Output = Result<Option<Arc<T>>>>;
fn get_latest<T: Object>(
&self,
object_id: ObjectId,
importance: Importance,
) -> impl Future<Output = Result<Arc<T>>>;
fn create_binary(
&self,
binary_id: BinPtr,
data: Arc<[u8]>,
) -> impl Future<Output = Result<()>>;
fn get_binary(
&self,
binary_id: BinPtr,
) -> impl Future<Output = Result<Option<Arc<[u8]>>>>;
fn reencode_old_versions<T: Object>(&self) -> impl Future<Output = usize>;
fn assert_invariants_generic(&self) -> impl Future<Output = ()>;
fn assert_invariants_for<T: Object>(&self) -> impl Future<Output = ()>;
}
Required Methods§
Sourcefn create<T: Object>(
&self,
object_id: ObjectId,
created_at: EventId,
object: Arc<T>,
updatedness: Option<Updatedness>,
additional_importance: Importance,
) -> impl Future<Output = Result<Option<Arc<T>>>>
fn create<T: Object>( &self, object_id: ObjectId, created_at: EventId, object: Arc<T>, updatedness: Option<Updatedness>, additional_importance: Importance, ) -> impl Future<Output = Result<Option<Arc<T>>>>
Returns the new latest snapshot if it actually changed
updatedness
is the up-to-date-ness of this creation, or None
if it is not known yet
(eg. it was initiated client-side and has not round-tripped to server yet)
Sourcefn submit<T: Object>(
&self,
object_id: ObjectId,
event_id: EventId,
event: Arc<T::Event>,
updatedness: Option<Updatedness>,
additional_importance: Importance,
) -> impl Future<Output = Result<Option<Arc<T>>>>
fn submit<T: Object>( &self, object_id: ObjectId, event_id: EventId, event: Arc<T::Event>, updatedness: Option<Updatedness>, additional_importance: Importance, ) -> impl Future<Output = Result<Option<Arc<T>>>>
Returns the new latest snapshot if it actually changed
updatedness
is the up-to-date-ness of this submission, or None
if it is not known yet
(eg. it was initiated client-side and has not round-tripped to server yet)
fn get_latest<T: Object>( &self, object_id: ObjectId, importance: Importance, ) -> impl Future<Output = Result<Arc<T>>>
fn create_binary( &self, binary_id: BinPtr, data: Arc<[u8]>, ) -> impl Future<Output = Result<()>>
fn get_binary( &self, binary_id: BinPtr, ) -> impl Future<Output = Result<Option<Arc<[u8]>>>>
Sourcefn reencode_old_versions<T: Object>(&self) -> impl Future<Output = usize>
fn reencode_old_versions<T: Object>(&self) -> impl Future<Output = usize>
Returns the number of errors that happened while re-encoding
fn assert_invariants_generic(&self) -> impl Future<Output = ()>
fn assert_invariants_for<T: Object>(&self) -> impl Future<Output = ()>
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.