pub struct TopicSyncManager<T, S, L, E>where
T: Clone,
E: Extensions,{ /* private fields */ }Expand description
Create and manage topic log sync sessions.
Sync sessions are created via the manager, which instantiates them with access to the shared topic map and operation store as well as channels for receiving sync events and for sending newly arriving operations in live mode.
A handle can be acquired to a sync session via the session_handle method for sending any live mode operations to a specific session. It’s expected that users map sessions (by their id) to any topic subscriptions in order to understand the correct mappings.
There are two points where message deduplication occurs; 1) per-subscription deduplication of received operations across all sessions for this manager occurs in the event stream 2) per-session deduplication occurs on sending operations to a remote, this is especially required during live-mode when we may receive the same new operation from several sources. The former stops any local consumers from receiving the same operation more than once, the latter reduces unnecessary noise on the network.
Implementations§
Source§impl<T, S, L, E> TopicSyncManager<T, S, L, E>where
T: Clone,
E: Extensions,
impl<T, S, L, E> TopicSyncManager<T, S, L, E>where
T: Clone,
E: Extensions,
Trait Implementations§
Source§impl<T, S, L, E> Manager<T> for TopicSyncManager<T, S, L, E>where
T: Clone + Debug + Eq + StdHash + Serialize + for<'a> Deserialize<'a> + Send + 'static,
S: LogStore<Operation<E>, VerifyingKey, L, SeqNum, Hash> + TopicStore<T, VerifyingKey, L> + Clone + Send + 'static,
L: LogId + Debug + Send + 'static,
E: Extensions + Send + 'static,
impl<T, S, L, E> Manager<T> for TopicSyncManager<T, S, L, E>where
T: Clone + Debug + Eq + StdHash + Serialize + for<'a> Deserialize<'a> + Send + 'static,
S: LogStore<Operation<E>, VerifyingKey, L, SeqNum, Hash> + TopicStore<T, VerifyingKey, L> + Clone + Send + 'static,
L: LogId + Debug + Send + 'static,
E: Extensions + Send + 'static,
Source§async fn session(
&mut self,
session_id: u64,
config: &SessionConfig<T>,
) -> Self::Protocol
async fn session( &mut self, session_id: u64, config: &SessionConfig<T>, ) -> Self::Protocol
Instantiate a new sync session.
Source§async fn session_handle(
&self,
session_id: u64,
) -> Option<Pin<Box<dyn Sink<ToTopicSync<E>, Error = Self::Error>>>>
async fn session_handle( &self, session_id: u64, ) -> Option<Pin<Box<dyn Sink<ToTopicSync<E>, Error = Self::Error>>>>
Retrieve a handle to a running sync session.
Source§fn subscribe(
&mut self,
) -> impl Stream<Item = FromSync<Self::Event>> + Send + Unpin + 'static
fn subscribe( &mut self, ) -> impl Stream<Item = FromSync<Self::Event>> + Send + Unpin + 'static
Subscribe to the event stream for all running sync sessions.
type Protocol = TopicLogSync<T, S, L, E>
type Args = S
type Event = TopicLogSyncEvent<E>
type Message = Operation<E>
type Error = TopicSyncManagerError
Auto Trait Implementations§
impl<T, S, L, E> !RefUnwindSafe for TopicSyncManager<T, S, L, E>
impl<T, S, L, E> !UnwindSafe for TopicSyncManager<T, S, L, E>
impl<T, S, L, E> Freeze for TopicSyncManager<T, S, L, E>where
S: Freeze,
impl<T, S, L, E> Send for TopicSyncManager<T, S, L, E>
impl<T, S, L, E> Sync for TopicSyncManager<T, S, L, E>
impl<T, S, L, E> Unpin for TopicSyncManager<T, S, L, E>
impl<T, S, L, E> UnsafeUnpin for TopicSyncManager<T, S, L, E>where
S: UnsafeUnpin,
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more