Db

Trait Db 

Source
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§

Source

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)

Source

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)

Source

fn get_latest<T: Object>( &self, object_id: ObjectId, importance: Importance, ) -> impl Future<Output = Result<Arc<T>>>

Source

fn create_binary( &self, binary_id: BinPtr, data: Arc<[u8]>, ) -> impl Future<Output = Result<()>>

Source

fn get_binary( &self, binary_id: BinPtr, ) -> impl Future<Output = Result<Option<Arc<[u8]>>>>

Source

fn reencode_old_versions<T: Object>(&self) -> impl Future<Output = usize>

Returns the number of errors that happened while re-encoding

Source

fn assert_invariants_generic(&self) -> impl Future<Output = ()>

Source

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.

Implementors§