pub struct InstrumentStore { /* private fields */ }Expand description
Local instrument storage with initialization tracking.
Provides add/find/get_all operations for instrument caching.
Not thread-safe by itself; wrap in Arc<RwLock<InstrumentStore>> when
sharing across async tasks or WebSocket handlers.
Storage preserves insertion order because adapters publish instruments to the data
engine straight from this store, and that emission sequence must hold across runs.
The map keeps the ahash hasher so ordered iteration costs nothing on lookup.
Implementations§
Source§impl InstrumentStore
impl InstrumentStore
Sourcepub fn add(&mut self, instrument: InstrumentAny)
pub fn add(&mut self, instrument: InstrumentAny)
Adds an instrument to the store, replacing any existing entry with the same ID.
Sourcepub fn add_bulk(&mut self, instruments: Vec<InstrumentAny>)
pub fn add_bulk(&mut self, instruments: Vec<InstrumentAny>)
Adds multiple instruments to the store.
Sourcepub fn find(&self, instrument_id: &InstrumentId) -> Option<&InstrumentAny>
pub fn find(&self, instrument_id: &InstrumentId) -> Option<&InstrumentAny>
Returns the instrument for the given ID, if found.
Sourcepub fn contains(&self, instrument_id: &InstrumentId) -> bool
pub fn contains(&self, instrument_id: &InstrumentId) -> bool
Returns whether the store contains the given instrument ID.
Sourcepub fn get_all(&self) -> &IndexMap<InstrumentId, InstrumentAny, RandomState>
pub fn get_all(&self) -> &IndexMap<InstrumentId, InstrumentAny, RandomState>
Returns all instruments as a map keyed by instrument ID.
Sourcepub fn is_initialized(&self) -> bool
pub fn is_initialized(&self) -> bool
Returns whether the store has been marked as initialized.
Sourcepub fn set_initialized(&mut self)
pub fn set_initialized(&mut self)
Marks the store as initialized.