pub trait ChangeStream:
Debug
+ Send
+ Sync
+ 'static {
// Required methods
fn write(&self, id: &ObjectId, size: u64, expires_at: Option<SystemTime>);
fn update(&self, id: &ObjectId, expires_at: Option<SystemTime>);
fn delete(&self, id: &ObjectId);
fn join<'life0, 'async_trait>(
&'life0 self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
}Expand description
Publishes the changes a single backend makes to the objects it stores.
See module docs.
Required Methods§
Sourcefn write(&self, id: &ObjectId, size: u64, expires_at: Option<SystemTime>)
fn write(&self, id: &ObjectId, size: u64, expires_at: Option<SystemTime>)
Reports that id now occupies size bytes. Used for new writes and overwrites.
Sourcefn update(&self, id: &ObjectId, expires_at: Option<SystemTime>)
fn update(&self, id: &ObjectId, expires_at: Option<SystemTime>)
Reports that id’s expiration moved, with its stored size unchanged.
Sourcefn delete(&self, id: &ObjectId)
fn delete(&self, id: &ObjectId)
Reports that id was deleted explicitly. Does not account for automatic GC.
Sourcefn join<'life0, 'async_trait>(
&'life0 self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn join<'life0, 'async_trait>(
&'life0 self,
timeout: Duration,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Blocks until reported records have been delivered, or timeout elapses.
Call this during shutdown to drain the change stream queue.
Waits for reported records to be delivered, or until timeout elapses.
Awaited from Backend::join so records
reported just before shutdown are not lost.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".