pub struct SyncEngine { /* private fields */ }Implementations§
Source§impl SyncEngine
impl SyncEngine
pub fn new(redis: Arc<RedisClient>) -> Self
Sourcepub async fn publish_event<T: Serialize + Send + Sync>(
&self,
stream_key: &str,
event: SyncEvent<T>,
) -> Result<(), AppError>
pub async fn publish_event<T: Serialize + Send + Sync>( &self, stream_key: &str, event: SyncEvent<T>, ) -> Result<(), AppError>
Publishes a Sync Event to the Redis Pub/Sub stream so a background worker can pick it up. Used by the primary database controller (e.g. Mongo).
Sourcepub async fn start_worker<T, U, M>(&self, stream_key: String, mapper: M)
pub async fn start_worker<T, U, M>(&self, stream_key: String, mapper: M)
Starts a background worker that listens to a Redis stream, maps the incoming data, and writes it to the target database (Polyglot Sync).
Auto Trait Implementations§
impl !RefUnwindSafe for SyncEngine
impl !UnwindSafe for SyncEngine
impl Freeze for SyncEngine
impl Send for SyncEngine
impl Sync for SyncEngine
impl Unpin for SyncEngine
impl UnsafeUnpin for SyncEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more