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
impl AliasCatalog
Sourcepub fn new() -> Self
pub fn new() -> Self
An empty catalog. Adapters populate it with insert
during chain normalization.
Sourcepub fn insert(&mut self, instrument: Instrument)
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.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
The number of distinct InstrumentKeys the catalog knows (not the
number of feed aliases).
Sourcepub fn instruments(&self) -> impl Iterator<Item = &Instrument>
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.
Sourcepub fn instrument(
&self,
key: &InstrumentKey,
provider: &ProviderId,
) -> Option<&Instrument>
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.
Sourcepub fn resolve_symbol(&self, symbol: &str) -> Option<&InstrumentKey>
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.
Sourcepub fn overlay_compatible(
&self,
key: &InstrumentKey,
source: &ProviderId,
overlay: &ProviderId,
) -> Result<(), OverlayError>
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
impl Clone for AliasCatalog
Source§fn clone(&self) -> AliasCatalog
fn clone(&self) -> AliasCatalog
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for AliasCatalog
impl Debug for AliasCatalog
Source§impl Default for AliasCatalog
impl Default for AliasCatalog
Source§fn default() -> AliasCatalog
fn default() -> AliasCatalog
Auto Trait Implementations§
impl Freeze for AliasCatalog
impl RefUnwindSafe for AliasCatalog
impl Send for AliasCatalog
impl Sync for AliasCatalog
impl Unpin for AliasCatalog
impl UnsafeUnpin for AliasCatalog
impl UnwindSafe for AliasCatalog
Blanket Implementations§
impl<T> Allocation for T
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,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> 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 moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.