MemDb

Struct MemDb 

Source
pub struct MemDb(/* private fields */);

Implementations§

Source§

impl MemDb

Source

pub fn new(is_server: bool) -> MemDb

Source

pub async fn recreate_all<T: Object>( &self, event_id: EventId, updatedness: Option<Updatedness>, ) -> Result<()>

Source

pub async fn memdb_query<T: Object>( &self, user: User, only_updated_since: Option<Updatedness>, query: &Query, ) -> Result<Vec<ObjectId>>

Trait Implementations§

Source§

impl ClientSideDb for MemDb

Source§

async fn storage_info(&self) -> Result<ClientStorageInfo>

Source§

async fn save_login(&self, _info: LoginInfo) -> Result<()>

Source§

async fn get_saved_login(&self) -> Result<Option<LoginInfo>>

Source§

async fn get_json( &self, _object_id: ObjectId, _importance: Importance, ) -> Result<Value>

Source§

async fn remove_everything(&self) -> Result<()>

Source§

async fn recreate<T: Object>( &self, object_id: ObjectId, new_created_at: EventId, object: Arc<T>, updatedness: Option<Updatedness>, additional_importance: Importance, ) -> Result<Option<Arc<T>>>

Either create an object if it did not exist yet, or recreate it Read more
Source§

async fn client_query( &self, _type_id: TypeId, _query: Arc<Query>, ) -> Result<Vec<ObjectId>>

Source§

async fn remove(&self, object_id: ObjectId) -> Result<()>

Source§

async fn remove_event<T: Object>( &self, _object_id: ObjectId, _event_id: EventId, ) -> Result<()>

Source§

async fn set_object_importance( &self, object_id: ObjectId, new_importance: Importance, ) -> Result<()>

Source§

async fn set_importance_from_queries( &self, object_id: ObjectId, new_importance_from_queries: Importance, ) -> Result<()>

Source§

async fn client_vacuum( &self, _notify_removals: impl 'static + CrdbSyncFn<ObjectId>, _notify_query_removals: impl 'static + CrdbSyncFn<QueryId>, ) -> Result<()>

Source§

async fn list_uploads(&self) -> Result<Vec<UploadId>>

Source§

async fn get_upload(&self, _upload_id: UploadId) -> Result<Option<Upload>>

Source§

async fn enqueue_upload( &self, _upload: Upload, _required_binaries: Vec<BinPtr>, ) -> Result<UploadId>

Source§

async fn upload_finished(&self, _upload_id: UploadId) -> Result<()>

Source§

async fn get_saved_objects(&self) -> Result<HashMap<ObjectId, SavedObjectMeta>>

Source§

async fn get_saved_queries(&self) -> Result<HashMap<QueryId, SavedQuery>>

Source§

async fn record_query( &self, _query_id: QueryId, _query: Arc<Query>, _type_id: TypeId, _importance: Importance, ) -> Result<()>

Source§

async fn set_query_importance( &self, _query_id: QueryId, _importance: Importance, _objects_matching_query: Vec<ObjectId>, ) -> Result<()>

Source§

async fn forget_query( &self, _query_id: QueryId, _objects_to_unlock: Vec<ObjectId>, ) -> Result<()>

Source§

async fn update_queries( &self, _queries: &HashSet<QueryId>, _now_have_all_until: Updatedness, ) -> Result<()>

Source§

impl Db for MemDb

Source§

async fn create<T: Object>( &self, object_id: ObjectId, created_at: EventId, object: Arc<T>, updatedness: Option<Updatedness>, importance: Importance, ) -> Result<Option<Arc<T>>>

Returns the new latest snapshot if it actually changed Read more
Source§

async fn submit<T: Object>( &self, object_id: ObjectId, event_id: EventId, event: Arc<T::Event>, updatedness: Option<Updatedness>, additional_importance: Importance, ) -> Result<Option<Arc<T>>>

Returns the new latest snapshot if it actually changed Read more
Source§

async fn get_latest<T: Object>( &self, object_id: ObjectId, importance: Importance, ) -> Result<Arc<T>>

Source§

async fn create_binary(&self, binary_id: BinPtr, data: Arc<[u8]>) -> Result<()>

Source§

async fn get_binary(&self, binary_id: BinPtr) -> Result<Option<Arc<[u8]>>>

Source§

async fn reencode_old_versions<T: Object>(&self) -> usize

Returns the number of errors that happened while re-encoding
Source§

async fn assert_invariants_generic(&self)

Source§

async fn assert_invariants_for<T: Object>(&self)

Auto Trait Implementations§

§

impl Freeze for MemDb

§

impl !RefUnwindSafe for MemDb

§

impl Send for MemDb

§

impl Sync for MemDb

§

impl Unpin for MemDb

§

impl !UnwindSafe for MemDb

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<D> CanDoCallbacks for D
where D: Db,

Source§

async fn get<T>(&self, object_id: DbPtr<T>) -> Result<Arc<T>, Error>
where T: Object,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> ErasedDestructor for T
where T: 'static,

Source§

impl<T> MaybeSendSync for T

Source§

impl<T> Send for T
where T: Send,

Source§

impl<T> Sync for T
where T: Sync,