use crate::{
CanDoCallbacks, ClientSideDb, Db, EventId, Importance, ObjectId, ReadPermsChanges,
ServerSideDb, TypeId, Update, Updatedness, User,
};
use std::{collections::HashSet, sync::Arc};
#[derive(Copy, Clone, Debug, serde::Deserialize, serde::Serialize)]
pub struct UploadId(pub i64);
#[derive(Debug)]
pub struct UpdatesWithSnap {
pub updates: Vec<Arc<Update>>,
pub new_last_snapshot: Option<Arc<serde_json::Value>>,
}
#[doc(hidden)]
pub mod private {
pub trait Sealed {}
}
pub trait Config: 'static + Send + Sync + private::Sealed {
fn check_ulids();
fn reencode_old_versions<D: Db>(call_on: &D) -> impl '_ + waaaa::Future<Output = usize>;
fn create<D: Db>(
db: &D,
type_id: TypeId,
object_id: ObjectId,
created_at: EventId,
snapshot_version: i32,
object: &serde_json::Value,
) -> impl waaaa::Future<Output = crate::Result<()>>;
#[allow(clippy::too_many_arguments)] fn recreate<D: ClientSideDb>(
db: &D,
type_id: TypeId,
object_id: ObjectId,
created_at: EventId,
snapshot_version: i32,
object: &serde_json::Value,
updatedness: Option<Updatedness>,
additional_importance: Importance,
) -> impl waaaa::Future<Output = crate::Result<Option<serde_json::Value>>>;
fn submit<D: Db>(
db: &D,
type_id: TypeId,
object_id: ObjectId,
event_id: EventId,
event: &serde_json::Value,
updatedness: Option<Updatedness>,
additional_importance: Importance,
) -> impl waaaa::Future<Output = crate::Result<Option<serde_json::Value>>>;
fn remove_event<D: ClientSideDb>(
db: &D,
type_id: TypeId,
object_id: ObjectId,
event_id: EventId,
) -> impl waaaa::Future<Output = crate::Result<()>>;
#[allow(clippy::type_complexity)]
fn get_users_who_can_read<'a, D: ServerSideDb, C: CanDoCallbacks>(
call_on: &'a D,
object_id: ObjectId,
type_id: TypeId,
snapshot_version: i32,
snapshot: serde_json::Value,
cb: &'a C,
) -> impl 'a + waaaa::Future<Output = crate::Result<crate::UsersWhoCanRead<D::Lock<'a>>>>;
#[allow(clippy::type_complexity)] fn recreate_no_lock<'a, D: ServerSideDb, C: CanDoCallbacks>(
call_on: &'a D,
type_id: TypeId,
object_id: ObjectId,
event_id: EventId,
updatedness: Updatedness,
cb: &'a C,
) -> impl 'a
+ waaaa::Future<
Output = crate::Result<Option<(EventId, i32, serde_json::Value, HashSet<User>)>>,
>;
#[allow(clippy::too_many_arguments, clippy::type_complexity)] fn upload_object<D: ServerSideDb>(
call_on: &D,
user: User,
updatedness: Updatedness,
type_id: TypeId,
object_id: ObjectId,
created_at: EventId,
snapshot_version: i32,
snapshot: Arc<serde_json::Value>,
) -> impl '_
+ waaaa::Future<
Output = crate::Result<
Option<(Arc<UpdatesWithSnap>, HashSet<User>, Vec<ReadPermsChanges>)>,
>,
>;
#[allow(clippy::type_complexity)] fn upload_event<D: ServerSideDb>(
call_on: &D,
user: User,
updatedness: Updatedness,
type_id: TypeId,
object_id: ObjectId,
event_id: EventId,
event: Arc<serde_json::Value>,
) -> impl '_
+ waaaa::Future<
Output = crate::Result<Option<(Arc<UpdatesWithSnap>, Vec<User>, Vec<ReadPermsChanges>)>>,
>;
}