pub struct FixSequenceTracker { /* private fields */ }Expand description
Deterministic inbound/outbound FIX sequence tracker.
Implementations§
Source§impl FixSequenceTracker
impl FixSequenceTracker
Sourcepub const fn new() -> Self
pub const fn new() -> Self
Creates a tracker with both inbound and outbound sequence numbers set to
1.
Sourcepub const fn from_next(next_inbound: u64, next_outbound: u64) -> Self
pub const fn from_next(next_inbound: u64, next_outbound: u64) -> Self
Creates a tracker from persisted next inbound and outbound values.
Values lower than 1 are clamped to 1 so restored state remains valid.
Sourcepub const fn next_inbound(&self) -> u64
pub const fn next_inbound(&self) -> u64
Returns the next inbound sequence number expected from the counterparty.
Sourcepub const fn next_outbound(&self) -> u64
pub const fn next_outbound(&self) -> u64
Returns the next outbound sequence number to assign.
Sourcepub fn assign_outbound(&mut self) -> u64
pub fn assign_outbound(&mut self) -> u64
Assigns and advances the next outbound sequence number.
Sourcepub fn observe_message(
&mut self,
message: &FixMessageView<'_>,
) -> Result<FixSequenceAction, FixSequenceError>
pub fn observe_message( &mut self, message: &FixMessageView<'_>, ) -> Result<FixSequenceAction, FixSequenceError>
Observes an inbound message and returns the sequence action.
§Errors
Returns FixSequenceError when MsgSeqNum(34) is missing or zero.
Sourcepub fn observe_inbound(
&mut self,
seq_no: u64,
poss_dup: bool,
) -> Result<FixSequenceAction, FixSequenceError>
pub fn observe_inbound( &mut self, seq_no: u64, poss_dup: bool, ) -> Result<FixSequenceAction, FixSequenceError>
Observes an inbound sequence number.
§Errors
Returns FixSequenceError::ZeroSeqNo when seq_no is zero.
Sourcepub fn apply_sequence_reset(
&mut self,
new_seq_no: u64,
) -> Result<(), FixSequenceError>
pub fn apply_sequence_reset( &mut self, new_seq_no: u64, ) -> Result<(), FixSequenceError>
Applies NewSeqNo(36) as the next expected inbound sequence number.
§Errors
Returns FixSequenceError::ZeroSeqNo for zero and
FixSequenceError::SequenceResetWouldDecrease when the reset would
lower the current expected sequence number.
Sourcepub fn set_next_inbound(&mut self, next_inbound: u64)
pub fn set_next_inbound(&mut self, next_inbound: u64)
Sets the next inbound sequence number from trusted persisted state.
Sourcepub fn set_next_outbound(&mut self, next_outbound: u64)
pub fn set_next_outbound(&mut self, next_outbound: u64)
Sets the next outbound sequence number from trusted persisted state.
Sourcepub fn snapshot<'a>(
&self,
session_id: FixSessionId<'a>,
trading_day: &'a [u8],
) -> Result<FixSequenceSnapshot<'a>, FixEncodeError>
pub fn snapshot<'a>( &self, session_id: FixSessionId<'a>, trading_day: &'a [u8], ) -> Result<FixSequenceSnapshot<'a>, FixEncodeError>
Creates a persistable snapshot for this tracker.
§Errors
Returns FixEncodeError when trading_day contains SOH.
Sourcepub const fn from_snapshot(snapshot: &FixSequenceSnapshot<'_>) -> Self
pub const fn from_snapshot(snapshot: &FixSequenceSnapshot<'_>) -> Self
Restores tracker counters from a sequence snapshot.
Sourcepub fn reset_to_one(&mut self)
pub fn reset_to_one(&mut self)
Resets both inbound and outbound counters to 1.