Skip to main content

TopicSyncManager

Struct TopicSyncManager 

Source
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,

Source

pub fn new(store: S) -> Self

Trait Implementations§

Source§

impl<T, S: Debug, L: Debug, E> Debug for TopicSyncManager<T, S, L, E>
where T: Clone + Debug, E: Extensions + Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
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,

Source§

fn from_args(store: Self::Args) -> Self

Instantiate a manager from arguments.

Source§

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>>>>

Retrieve a handle to a running sync session.

Source§

fn subscribe( &mut self, ) -> impl Stream<Item = FromSync<Self::Event>> + Send + Unpin + 'static

Subscribe to the event stream for all running sync sessions.

Source§

type Protocol = TopicLogSync<T, S, L, E>

Source§

type Args = S

Source§

type Event = TopicLogSyncEvent<E>

Source§

type Message = Operation<E>

Source§

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>
where S: Send, L: Send, T: Send, E: Send,

§

impl<T, S, L, E> Sync for TopicSyncManager<T, S, L, E>
where S: Sync, L: Sync, T: Sync + Send, E: Send,

§

impl<T, S, L, E> Unpin for TopicSyncManager<T, S, L, E>
where S: Unpin, L: Unpin, T: Unpin,

§

impl<T, S, L, E> UnsafeUnpin for TopicSyncManager<T, S, L, E>
where S: UnsafeUnpin,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

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