Config

Trait Config 

Source
pub trait Config:
    'static
    + Send
    + Sync
    + Sealed {
    // Required methods
    fn check_ulids();
    fn reencode_old_versions<D>(call_on: &D) -> impl Future
       where D: Db;
    fn create<D>(
        db: &D,
        type_id: TypeId,
        object_id: ObjectId,
        created_at: EventId,
        snapshot_version: i32,
        object: &Value,
    ) -> impl Future
       where D: Db;
    fn recreate<D>(
        db: &D,
        type_id: TypeId,
        object_id: ObjectId,
        created_at: EventId,
        snapshot_version: i32,
        object: &Value,
        updatedness: Option<Updatedness>,
        additional_importance: Importance,
    ) -> impl Future
       where D: ClientSideDb;
    fn submit<D>(
        db: &D,
        type_id: TypeId,
        object_id: ObjectId,
        event_id: EventId,
        event: &Value,
        updatedness: Option<Updatedness>,
        additional_importance: Importance,
    ) -> impl Future
       where D: Db;
    fn remove_event<D>(
        db: &D,
        type_id: TypeId,
        object_id: ObjectId,
        event_id: EventId,
    ) -> impl Future
       where D: ClientSideDb;
    fn get_users_who_can_read<'a, D, C>(
        call_on: &'a D,
        object_id: ObjectId,
        type_id: TypeId,
        snapshot_version: i32,
        snapshot: Value,
        cb: &'a C,
    ) -> impl Future + 'a
       where D: ServerSideDb,
             C: CanDoCallbacks;
    fn recreate_no_lock<'a, D, C>(
        call_on: &'a D,
        type_id: TypeId,
        object_id: ObjectId,
        event_id: EventId,
        updatedness: Updatedness,
        cb: &'a C,
    ) -> impl Future + 'a
       where D: ServerSideDb,
             C: CanDoCallbacks;
    fn upload_object<D>(
        call_on: &D,
        user: User,
        updatedness: Updatedness,
        type_id: TypeId,
        object_id: ObjectId,
        created_at: EventId,
        snapshot_version: i32,
        snapshot: Arc<Value>,
    ) -> impl Future
       where D: ServerSideDb;
    fn upload_event<D>(
        call_on: &D,
        user: User,
        updatedness: Updatedness,
        type_id: TypeId,
        object_id: ObjectId,
        event_id: EventId,
        event: Arc<Value>,
    ) -> impl Future
       where D: ServerSideDb;
}

Required Methods§

Source

fn check_ulids()

Auto-generated by crdb::db!.

Panics if there are two types with the same ULID configured

Source

fn reencode_old_versions<D>(call_on: &D) -> impl Future
where D: Db,

Source

fn create<D>( db: &D, type_id: TypeId, object_id: ObjectId, created_at: EventId, snapshot_version: i32, object: &Value, ) -> impl Future
where D: Db,

Source

fn recreate<D>( db: &D, type_id: TypeId, object_id: ObjectId, created_at: EventId, snapshot_version: i32, object: &Value, updatedness: Option<Updatedness>, additional_importance: Importance, ) -> impl Future
where D: ClientSideDb,

The returned serde_json::Value is guaranteed to be a serialization of the latest snapshot of the object at the current snapshot version

Source

fn submit<D>( db: &D, type_id: TypeId, object_id: ObjectId, event_id: EventId, event: &Value, updatedness: Option<Updatedness>, additional_importance: Importance, ) -> impl Future
where D: Db,

The returned serde_json::Value is guaranteed to be a serialization of the latest snapshot of the object at the current snapshot version

Source

fn remove_event<D>( db: &D, type_id: TypeId, object_id: ObjectId, event_id: EventId, ) -> impl Future
where D: ClientSideDb,

Source

fn get_users_who_can_read<'a, D, C>( call_on: &'a D, object_id: ObjectId, type_id: TypeId, snapshot_version: i32, snapshot: Value, cb: &'a C, ) -> impl Future + 'a

Source

fn recreate_no_lock<'a, D, C>( call_on: &'a D, type_id: TypeId, object_id: ObjectId, event_id: EventId, updatedness: Updatedness, cb: &'a C, ) -> impl Future + 'a

Source

fn upload_object<D>( call_on: &D, user: User, updatedness: Updatedness, type_id: TypeId, object_id: ObjectId, created_at: EventId, snapshot_version: i32, snapshot: Arc<Value>, ) -> impl Future
where D: ServerSideDb,

Source

fn upload_event<D>( call_on: &D, user: User, updatedness: Updatedness, type_id: TypeId, object_id: ObjectId, event_id: EventId, event: Arc<Value>, ) -> impl Future
where D: ServerSideDb,

The Vec<User> in return type is the list of users who can read the object both before and after the change. Users who gained or lost access to object_id are returned as part of the Vec<ReadPermsChanges>.

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§