Skip to main content

AliasCatalog

Struct AliasCatalog 

Source
pub struct AliasCatalog { /* private fields */ }
Expand description

The per-leg alias index the ChainFetch carries so normalization does not discard the identifiers needed to subscribe, resubscribe, and join later updates (docs/01-domain-model.md §6, docs/03-data-providers.md §4).

It maps the provider-agnostic InstrumentKey to each feed’s Instrument (native + stream symbol plus its ContractSpecFingerprint), holding no raw upstream DTO. One key can map to several Instruments — one per feed that knows this leg (a source chain plus, e.g., a DXLink overlay) — which is how a cross-provider overlay joins a chain seeded by a different provider.

The per-leg fingerprint is what the cross-provider overlay merge compares to refuse an economically non-equivalent leg (overlay_compatible).

Implementations§

Source§

impl AliasCatalog

Source

pub fn new() -> Self

An empty catalog. Adapters populate it with insert during chain normalization.

Source

pub fn insert(&mut self, instrument: Instrument)

Register a feed’s view of a leg. Multiple feeds can register the same InstrumentKey — each becomes a distinct alias entry under that key.

Re-inserting the same (key, provider) replaces the prior entry in place rather than appending a duplicate, so the catalog stays a function of (key, provider) and instrument returns the current view, never a stale first match.

Source

pub fn is_empty(&self) -> bool

True when no leg has been registered.

Source

pub fn len(&self) -> usize

The number of distinct InstrumentKeys the catalog knows (not the number of feed aliases).

Source

pub fn instruments(&self) -> impl Iterator<Item = &Instrument>

Every feed alias the catalog holds, across all keys — the enumeration a provider adapter uses to resubscribe off the fresh aliases after a reconnect re-fetch (docs/03-data-providers.md §5), so it never re-derives symbols from strikes. The iteration order is unspecified (the backing map is unordered); a caller that needs the legs for one feed filters on Instrument::provider.

Source

pub fn instrument( &self, key: &InstrumentKey, provider: &ProviderId, ) -> Option<&Instrument>

The native/stream symbols (and spec fingerprint) to (re)subscribe for one leg on a given feed, or None when that feed does not know the leg.

Source

pub fn resolve_symbol(&self, symbol: &str) -> Option<&InstrumentKey>

Resolve an incoming stream/native symbol back to the shared InstrumentKey — the reverse join the DXLink overlay and the poll→stream merge both use (docs/03-data-providers.md §4). Matches a leg’s native_symbol or its stream_symbol.

Source

pub fn overlay_compatible( &self, key: &InstrumentKey, source: &ProviderId, overlay: &ProviderId, ) -> Result<(), OverlayError>

The cross-provider overlay gate (docs/01-domain-model.md §4): the two feeds’ Instruments for one key may merge only when their ContractSpecFingerprints are equal.

The InstrumentKey 4-tuple proves the two feeds name the same option; this compares the economic-equivalence fingerprint before a live overlay quote is allowed to overwrite a source-chain leg. The within-provider poll→stream merge passes the same provider for source and overlay, so it compares one fingerprint against itself — a no-op that always succeeds.

The store-level invocation of this gate during the merge lands with the ChainStore in issue #7; this is the comparison primitive it calls, with the full fingerprint comparison already wired here.

§Errors

OverlayError::SpecMismatch naming the first fingerprint dimension that disagrees (multiplier / settlement / exercise / quote currency / venue product code) — never a raw payload or credential.

OverlayError::MissingAlias when either feed does not know the leg: there is no fingerprint pair to compare, so the gate fails CLOSED (naming the absent feed) rather than admitting an unverified overlay. The caller (gate_overlay) treats only Ok(()) as permission to merge, so a missing alias refuses the merge instead of resurrecting an unchecked leg.

Trait Implementations§

Source§

impl Clone for AliasCatalog

Source§

fn clone(&self) -> AliasCatalog

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for AliasCatalog

Source§

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

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

impl Default for AliasCatalog

Source§

fn default() -> AliasCatalog

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

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
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> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

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

Source§

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

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
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<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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.
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