Skip to main content

WsDispatchState

Struct WsDispatchState 

Source
pub struct WsDispatchState {
    pub order_identities: DashMap<ClientOrderId, OrderIdentity>,
    pub pending_requests: DashMap<String, PendingRequest>,
    pub cancel_replace_request_ids: DashMap<String, String>,
    /* private fields */
}
Expand description

Tracks order lifecycle state for dispatch routing.

Orders with a registered identity produce typed order events. Untracked orders fall back to execution reports for reconciliation. For restored orders, accepted and filled state, plus the trade IDs known at restoration, remain available until terminal cleanup, independent of the bounded deduplication caches.

Fields§

§order_identities: DashMap<ClientOrderId, OrderIdentity>§pending_requests: DashMap<String, PendingRequest>§cancel_replace_request_ids: DashMap<String, String>

Cancel-replace request IDs mapped to their cancelNewClientOrderId.

Implementations§

Source§

impl WsDispatchState

Source

pub fn has_emitted_accepted(&self, cid: &ClientOrderId) -> bool

Source

pub fn insert_accepted(&self, cid: ClientOrderId)

Marks an order as having emitted an OrderAccepted event.

Source

pub fn has_filled(&self, cid: &ClientOrderId) -> bool

Source

pub fn insert_filled(&self, cid: ClientOrderId)

Marks an order as having received a fill.

Source

pub fn insert_cancel_replace(&self, cancel_id: String)

Records the cancelNewClientOrderId sent with a cancel-replace request.

Source

pub fn has_cancel_replace(&self, cancel_id: &str) -> bool

Returns true when cancel_id belongs to a cancel-replace this client issued.

Source

pub fn on_cancel_replace_canceled( &self, cancel_id: &str, report: OrderStatusReport, ) -> bool

Records the cancel half’s CANCELED report for a cancel-replace request.

Returns true when the report must be withheld because the replacement is pending or succeeded, and false when it should dispatch as a standalone cancel because the venue already rejected the replacement or the ID is not one this client issued.

Source

pub fn on_cancel_replace_rejected( &self, cancel_id: &str, ) -> Option<OrderStatusReport>

Records a rejected cancel-replace request.

Returns the withheld cancel report when it already arrived, so the caller can emit the confirmed cancellation for the original order.

Source

pub fn insert_algo_order_id( &self, cid: ClientOrderId, venue_order_id: VenueOrderId, )

Source

pub fn promote_algo_order_id( &self, cid: ClientOrderId, venue_order_id: VenueOrderId, ) -> Option<bool>

Promotes a known Algo order to its matching-engine venue order ID.

Returns None for an unknown Algo order, Some(true) for a new ID, and Some(false) when the ID was already current.

Source

pub fn promoted_algo_order_id( &self, cid: &ClientOrderId, ) -> Option<VenueOrderId>

Returns the matching-engine venue order ID for a promoted Algo order.

Source

pub fn cleanup_terminal(&self, cid: ClientOrderId)

Removes all tracking state for a terminal order.

Trait Implementations§

Source§

impl Debug for WsDispatchState

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for WsDispatchState

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

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
§

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

§

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.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

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
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

impl<T> PolicyExt for T
where T: ?Sized,

§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] only if self and other return Action::Follow. Read more
§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns [Action::Follow] if either self or other returns Action::Follow. Read more
§

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

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

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

impl<T> Ungil for T
where T: Send,

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

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
§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more