pub trait ServerSideDb:
'static
+ Send
+ Sync
+ Db {
type Connection: Send;
type Transaction<'a>: Send;
type Lock<'a>: Send;
Show 16 methods
// Required methods
fn get_users_who_can_read<'a, 'ret, T, C>(
&'ret self,
object_id: ObjectId,
object: &'a T,
cb: &'a C,
) -> Pin<Box<dyn Future<Output = Result<UsersWhoCanRead<Self::Lock<'ret>>, Error>> + 'a>>
where 'ret: 'a,
T: Object,
C: CanDoCallbacks;
fn get_transaction(&self) -> impl Future;
fn get_latest_snapshot(
&self,
transaction: &mut Self::Connection,
user: User,
object_id: ObjectId,
) -> impl Future;
fn get_all(
&self,
transaction: &mut Self::Connection,
user: User,
object_id: ObjectId,
only_updated_since: Option<Updatedness>,
) -> impl Future;
fn server_query(
&self,
user: User,
type_id: TypeId,
only_updated_since: Option<Updatedness>,
query: Arc<Query>,
) -> impl Future;
fn server_vacuum(
&self,
no_new_changes_before: Option<EventId>,
updatedness: Updatedness,
kill_sessions_older_than: Option<SystemTime>,
notify_recreation: impl FnMut(Update, HashSet<User>),
) -> impl Future<Output = Result<(), Error>>;
fn recreate_at<'a, T, C>(
&'a self,
object_id: ObjectId,
event_id: EventId,
updatedness: Updatedness,
cb: &'a C,
) -> impl Future + 'a
where T: Object,
C: CanDoCallbacks;
fn create_and_return_rdep_changes<T>(
&self,
object_id: ObjectId,
created_at: EventId,
object: Arc<T>,
updatedness: Updatedness,
) -> impl Future
where T: Object;
fn submit_and_return_rdep_changes<T>(
&self,
object_id: ObjectId,
event_id: EventId,
event: Arc<<T as Object>::Event>,
updatedness: Updatedness,
) -> impl Future
where T: Object;
fn update_pending_rdeps(&self) -> impl Future;
fn login_session(&self, session: Session) -> impl Future;
fn resume_session(&self, token: SessionToken) -> impl Future;
fn mark_session_active(
&self,
token: SessionToken,
at: SystemTime,
) -> impl Future;
fn rename_session<'a>(
&'a self,
token: SessionToken,
new_name: &'a str,
) -> impl Future + 'a;
fn list_sessions(&self, user: User) -> impl Future;
fn disconnect_session(&self, user: User, session: SessionRef) -> impl Future;
}
Required Associated Types§
Required Methods§
fn get_users_who_can_read<'a, 'ret, T, C>(
&'ret self,
object_id: ObjectId,
object: &'a T,
cb: &'a C,
) -> Pin<Box<dyn Future<Output = Result<UsersWhoCanRead<Self::Lock<'ret>>, Error>> + 'a>>where
'ret: 'a,
T: Object,
C: CanDoCallbacks,
fn get_transaction(&self) -> impl Future
fn get_latest_snapshot( &self, transaction: &mut Self::Connection, user: User, object_id: ObjectId, ) -> impl Future
fn get_all( &self, transaction: &mut Self::Connection, user: User, object_id: ObjectId, only_updated_since: Option<Updatedness>, ) -> impl Future
fn server_query( &self, user: User, type_id: TypeId, only_updated_since: Option<Updatedness>, query: Arc<Query>, ) -> impl Future
Sourcefn server_vacuum(
&self,
no_new_changes_before: Option<EventId>,
updatedness: Updatedness,
kill_sessions_older_than: Option<SystemTime>,
notify_recreation: impl FnMut(Update, HashSet<User>),
) -> impl Future<Output = Result<(), Error>>
fn server_vacuum( &self, no_new_changes_before: Option<EventId>, updatedness: Updatedness, kill_sessions_older_than: Option<SystemTime>, notify_recreation: impl FnMut(Update, HashSet<User>), ) -> impl Future<Output = Result<(), Error>>
Cleans up and optimizes up the database
After running this, the database will reject any new change that would happen before
no_new_changes_before
if it is set.
Sourcefn recreate_at<'a, T, C>(
&'a self,
object_id: ObjectId,
event_id: EventId,
updatedness: Updatedness,
cb: &'a C,
) -> impl Future + 'awhere
T: Object,
C: CanDoCallbacks,
fn recreate_at<'a, T, C>(
&'a self,
object_id: ObjectId,
event_id: EventId,
updatedness: Updatedness,
cb: &'a C,
) -> impl Future + 'awhere
T: Object,
C: CanDoCallbacks,
This function assumes that the lock on object_id
is already taken
Returns Some
iff the object actually changed
fn create_and_return_rdep_changes<T>(
&self,
object_id: ObjectId,
created_at: EventId,
object: Arc<T>,
updatedness: Updatedness,
) -> impl Futurewhere
T: Object,
fn submit_and_return_rdep_changes<T>(
&self,
object_id: ObjectId,
event_id: EventId,
event: Arc<<T as Object>::Event>,
updatedness: Updatedness,
) -> impl Futurewhere
T: Object,
fn update_pending_rdeps(&self) -> impl Future
fn login_session(&self, session: Session) -> impl Future
fn resume_session(&self, token: SessionToken) -> impl Future
fn mark_session_active( &self, token: SessionToken, at: SystemTime, ) -> impl Future
fn rename_session<'a>( &'a self, token: SessionToken, new_name: &'a str, ) -> impl Future + 'a
fn list_sessions(&self, user: User) -> impl Future
fn disconnect_session(&self, user: User, session: SessionRef) -> impl Future
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.