pub struct BookSyncTracker { /* private fields */ }Expand description
Sequence, snapshot, and recovery state of each subscribed book.
A book accepts messages only after Self::record_subscription registers it; Self::apply
suppresses messages for any other book.
Implementations§
Source§impl BookSyncTracker
impl BookSyncTracker
Sourcepub fn record_subscription(
&self,
instrument_id: InstrumentId,
subscription: Subscription,
now: Instant,
gate: SnapshotGate,
) -> CancellationToken
pub fn record_subscription( &self, instrument_id: InstrumentId, subscription: Subscription, now: Instant, gate: SnapshotGate, ) -> CancellationToken
Replaces the book with one waiting for its first snapshot behind gate.
Sourcepub fn apply(
&self,
instrument_id: InstrumentId,
frame: BookFrame<'_>,
instrument: &InstrumentAny,
now: Instant,
) -> (BookSequenceOutcome, Option<OrderBookDeltas>)
pub fn apply( &self, instrument_id: InstrumentId, frame: BookFrame<'_>, instrument: &InstrumentAny, now: Instant, ) -> (BookSequenceOutcome, Option<OrderBookDeltas>)
Validates a message and converts it once accepted.
Returns [BookSequenceOutcome::Recover] when the caller must start a recovery, and deltas
only for an accepted message that changes the book.
Sourcepub fn depth_sequence(&self, instrument_id: InstrumentId, sequence: u64) -> u64
pub fn depth_sequence(&self, instrument_id: InstrumentId, sequence: u64) -> u64
Returns the emitted sequence of a depth snapshot at venue sequence.
Each depth message lists complete top levels, so the stream advances by the venue step and continues from its last emitted sequence when CoinAPI restarts the venue sequence.
Sourcepub fn reset_on_reconnect(&self, deadline: Option<Instant>) -> usize
pub fn reset_on_reconnect(&self, deadline: Option<Instant>) -> usize
Restarts every book after its connection reconnects, arming a snapshot deadline when
given, and returns how many deadlines were armed.
Trait Implementations§
Source§impl Clone for BookSyncTracker
impl Clone for BookSyncTracker
Source§impl Debug for BookSyncTracker
impl Debug for BookSyncTracker
Auto Trait Implementations§
impl !RefUnwindSafe for BookSyncTracker
impl !UnwindSafe for BookSyncTracker
impl Freeze for BookSyncTracker
impl Send for BookSyncTracker
impl Sync for BookSyncTracker
impl Unpin for BookSyncTracker
impl UnsafeUnpin for BookSyncTracker
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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