pub struct TestCacheDatabase { /* private fields */ }Expand description
Stateful cache database adapter for lifecycle tests.
Trait Implementations§
Source§impl CacheDatabaseAdapter for TestCacheDatabase
impl CacheDatabaseAdapter for TestCacheDatabase
Source§fn load_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CacheMap>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_all<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<CacheMap>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all cached data into memory. Read more
Source§fn load(&self) -> Result<AHashMap<String, Bytes>>
fn load(&self) -> Result<AHashMap<String, Bytes>>
Loads raw key-value data from the database. Read more
Source§fn load_currencies<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<Ustr, Currency>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_currencies<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<Ustr, Currency>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all currencies from the cache. Read more
Source§fn load_instruments<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<InstrumentId, InstrumentAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_instruments<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<InstrumentId, InstrumentAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all instruments from the cache. Read more
Source§fn load_synthetics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<InstrumentId, SyntheticInstrument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_synthetics<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<InstrumentId, SyntheticInstrument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all synthetic instruments from the cache. Read more
Source§fn load_accounts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<AccountId, AccountAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_accounts<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<AccountId, AccountAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all accounts from the cache. Read more
Source§fn load_orders<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<ClientOrderId, OrderAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_orders<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<ClientOrderId, OrderAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all orders from the cache. Read more
Source§fn load_positions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<PositionId, Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn load_positions<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<PositionId, Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Loads all positions from the cache. Read more
Source§fn load_index_order_position(
&self,
) -> Result<AHashMap<ClientOrderId, PositionId>>
fn load_index_order_position( &self, ) -> Result<AHashMap<ClientOrderId, PositionId>>
Loads mapping from order IDs to position IDs. Read more
Source§fn load_index_order_client(&self) -> Result<AHashMap<ClientOrderId, ClientId>>
fn load_index_order_client(&self) -> Result<AHashMap<ClientOrderId, ClientId>>
Loads mapping from order IDs to client IDs. Read more
Source§fn load_currency<'life0, 'life1, 'async_trait>(
&'life0 self,
_code: &'life1 Ustr,
) -> Pin<Box<dyn Future<Output = Result<Option<Currency>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_currency<'life0, 'life1, 'async_trait>(
&'life0 self,
_code: &'life1 Ustr,
) -> Pin<Box<dyn Future<Output = Result<Option<Currency>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads a single currency by code. Read more
Source§fn load_instrument<'life0, 'life1, 'async_trait>(
&'life0 self,
_instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<Option<InstrumentAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_instrument<'life0, 'life1, 'async_trait>(
&'life0 self,
_instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<Option<InstrumentAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads a single instrument by ID. Read more
Source§fn load_synthetic<'life0, 'life1, 'async_trait>(
&'life0 self,
_instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<Option<SyntheticInstrument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_synthetic<'life0, 'life1, 'async_trait>(
&'life0 self,
_instrument_id: &'life1 InstrumentId,
) -> Pin<Box<dyn Future<Output = Result<Option<SyntheticInstrument>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads a single synthetic instrument by ID. Read more
Source§fn load_account<'life0, 'life1, 'async_trait>(
&'life0 self,
_account_id: &'life1 AccountId,
) -> Pin<Box<dyn Future<Output = Result<Option<AccountAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_account<'life0, 'life1, 'async_trait>(
&'life0 self,
_account_id: &'life1 AccountId,
) -> Pin<Box<dyn Future<Output = Result<Option<AccountAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads a single account by ID. Read more
Source§fn load_order<'life0, 'life1, 'async_trait>(
&'life0 self,
_client_order_id: &'life1 ClientOrderId,
) -> Pin<Box<dyn Future<Output = Result<Option<OrderAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_order<'life0, 'life1, 'async_trait>(
&'life0 self,
_client_order_id: &'life1 ClientOrderId,
) -> Pin<Box<dyn Future<Output = Result<Option<OrderAny>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads a single order by client order ID. Read more
Source§fn load_position<'life0, 'life1, 'async_trait>(
&'life0 self,
_position_id: &'life1 PositionId,
) -> Pin<Box<dyn Future<Output = Result<Option<Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn load_position<'life0, 'life1, 'async_trait>(
&'life0 self,
_position_id: &'life1 PositionId,
) -> Pin<Box<dyn Future<Output = Result<Option<Position>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Loads a single position by position ID. Read more
Source§fn load_actor(
&self,
component_id: &ComponentId,
) -> Result<AHashMap<String, Bytes>>
fn load_actor( &self, component_id: &ComponentId, ) -> Result<AHashMap<String, Bytes>>
Loads actor state by component ID. Read more
Source§fn load_strategy(
&self,
strategy_id: &StrategyId,
) -> Result<AHashMap<String, Bytes>>
fn load_strategy( &self, strategy_id: &StrategyId, ) -> Result<AHashMap<String, Bytes>>
Loads strategy state by strategy ID. Read more
Source§fn load_custom_data(&self, _data_type: &DataType) -> Result<Vec<CustomData>>
fn load_custom_data(&self, _data_type: &DataType) -> Result<Vec<CustomData>>
Loads custom data by data type. Read more
Source§fn load_order_snapshot(
&self,
_client_order_id: &ClientOrderId,
) -> Result<Option<OrderSnapshot>>
fn load_order_snapshot( &self, _client_order_id: &ClientOrderId, ) -> Result<Option<OrderSnapshot>>
Loads an order snapshot by client order ID. Read more
Source§fn load_position_snapshot(
&self,
_position_id: &PositionId,
) -> Result<Option<PositionSnapshot>>
fn load_position_snapshot( &self, _position_id: &PositionId, ) -> Result<Option<PositionSnapshot>>
Loads a position snapshot by position ID. Read more
Source§fn load_quotes(&self, _instrument_id: &InstrumentId) -> Result<Vec<QuoteTick>>
fn load_quotes(&self, _instrument_id: &InstrumentId) -> Result<Vec<QuoteTick>>
Loads quote ticks by instrument ID. Read more
Source§fn load_trades(&self, _instrument_id: &InstrumentId) -> Result<Vec<TradeTick>>
fn load_trades(&self, _instrument_id: &InstrumentId) -> Result<Vec<TradeTick>>
Loads trade ticks by instrument ID. Read more
Source§fn load_funding_rates(
&self,
_instrument_id: &InstrumentId,
) -> Result<Vec<FundingRateUpdate>>
fn load_funding_rates( &self, _instrument_id: &InstrumentId, ) -> Result<Vec<FundingRateUpdate>>
Loads funding rate updates by instrument ID. Read more
Source§fn load_bars(&self, _instrument_id: &InstrumentId) -> Result<Vec<Bar>>
fn load_bars(&self, _instrument_id: &InstrumentId) -> Result<Vec<Bar>>
Loads bars by instrument ID. Read more
Source§fn add(&self, _key: String, _value: Bytes) -> Result<()>
fn add(&self, _key: String, _value: Bytes) -> Result<()>
Adds a generic key-value pair to the cache. Read more
Source§fn add_currency(&self, _currency: &Currency) -> Result<()>
fn add_currency(&self, _currency: &Currency) -> Result<()>
Adds a currency to the cache. Read more
Source§fn add_instrument(&self, _instrument: &InstrumentAny) -> Result<()>
fn add_instrument(&self, _instrument: &InstrumentAny) -> Result<()>
Adds an instrument to the cache. Read more
Source§fn add_synthetic(&self, _synthetic: &SyntheticInstrument) -> Result<()>
fn add_synthetic(&self, _synthetic: &SyntheticInstrument) -> Result<()>
Adds a synthetic instrument to the cache. Read more
Source§fn add_account(&self, _account: &AccountAny) -> Result<()>
fn add_account(&self, _account: &AccountAny) -> Result<()>
Adds an account to the cache. Read more
Source§fn add_order(
&self,
_order: &OrderAny,
_client_id: Option<ClientId>,
) -> Result<()>
fn add_order( &self, _order: &OrderAny, _client_id: Option<ClientId>, ) -> Result<()>
Adds an order to the cache. Read more
Source§fn add_order_snapshot(&self, _snapshot: &OrderSnapshot) -> Result<()>
fn add_order_snapshot(&self, _snapshot: &OrderSnapshot) -> Result<()>
Adds an order snapshot to the cache. Read more
Source§fn add_position(&self, _position: &Position) -> Result<()>
fn add_position(&self, _position: &Position) -> Result<()>
Adds a position to the cache. Read more
Source§fn add_position_snapshot(&self, _snapshot: &PositionSnapshot) -> Result<()>
fn add_position_snapshot(&self, _snapshot: &PositionSnapshot) -> Result<()>
Adds a position snapshot to the cache. Read more
Source§fn add_order_book(&self, _order_book: &OrderBook) -> Result<()>
fn add_order_book(&self, _order_book: &OrderBook) -> Result<()>
Adds an order book to the cache. Read more
Source§fn add_custom_data(&self, _data: &CustomData) -> Result<()>
fn add_custom_data(&self, _data: &CustomData) -> Result<()>
Adds custom data to the cache. Read more
Source§fn add_quote(&self, _quote: &QuoteTick) -> Result<()>
fn add_quote(&self, _quote: &QuoteTick) -> Result<()>
Adds a quote tick to the cache. Read more
Source§fn add_trade(&self, _trade: &TradeTick) -> Result<()>
fn add_trade(&self, _trade: &TradeTick) -> Result<()>
Adds a trade tick to the cache. Read more
Source§fn add_funding_rate(&self, _funding_rate: &FundingRateUpdate) -> Result<()>
fn add_funding_rate(&self, _funding_rate: &FundingRateUpdate) -> Result<()>
Adds a funding rate update to the cache. Read more
Source§fn add_greeks(&self, _greeks: &GreeksData) -> Result<()>
fn add_greeks(&self, _greeks: &GreeksData) -> Result<()>
Adds greeks data to the cache. Read more
Source§fn add_yield_curve(&self, _yield_curve: &YieldCurveData) -> Result<()>
fn add_yield_curve(&self, _yield_curve: &YieldCurveData) -> Result<()>
Adds yield curve data to the cache. Read more
Source§fn delete_actor(&self, _component_id: &ComponentId) -> Result<()>
fn delete_actor(&self, _component_id: &ComponentId) -> Result<()>
Deletes actor state from the cache. Read more
Source§fn delete_strategy(&self, _component_id: &StrategyId) -> Result<()>
fn delete_strategy(&self, _component_id: &StrategyId) -> Result<()>
Deletes strategy state from the cache. Read more
Source§fn delete_order(&self, _client_order_id: &ClientOrderId) -> Result<()>
fn delete_order(&self, _client_order_id: &ClientOrderId) -> Result<()>
Deletes an order from the cache. Read more
Source§fn delete_position(&self, _position_id: &PositionId) -> Result<()>
fn delete_position(&self, _position_id: &PositionId) -> Result<()>
Deletes a position from the cache. Read more
Source§fn delete_account_event(
&self,
_account_id: &AccountId,
_event_id: &str,
) -> Result<()>
fn delete_account_event( &self, _account_id: &AccountId, _event_id: &str, ) -> Result<()>
Deletes an account event from the cache. Read more
Source§fn index_venue_order_id(
&self,
_client_order_id: ClientOrderId,
_venue_order_id: VenueOrderId,
) -> Result<()>
fn index_venue_order_id( &self, _client_order_id: ClientOrderId, _venue_order_id: VenueOrderId, ) -> Result<()>
Indexes a venue order ID with its client order ID. Read more
Source§fn index_order_position(
&self,
_client_order_id: ClientOrderId,
_position_id: PositionId,
) -> Result<()>
fn index_order_position( &self, _client_order_id: ClientOrderId, _position_id: PositionId, ) -> Result<()>
Indexes an order-position mapping. Read more
Source§fn update_actor(
&self,
component_id: &ComponentId,
actor_state: &AHashMap<String, Bytes>,
) -> Result<()>
fn update_actor( &self, component_id: &ComponentId, actor_state: &AHashMap<String, Bytes>, ) -> Result<()>
Updates actor state in the cache. Read more
Source§fn update_strategy(
&self,
strategy_id: &StrategyId,
strategy_state: &AHashMap<String, Bytes>,
) -> Result<()>
fn update_strategy( &self, strategy_id: &StrategyId, strategy_state: &AHashMap<String, Bytes>, ) -> Result<()>
Updates strategy state in the cache. Read more
Source§fn update_account(&self, _account: &AccountAny) -> Result<()>
fn update_account(&self, _account: &AccountAny) -> Result<()>
Updates an account in the cache. Read more
Source§fn update_order(&self, _order_event: &OrderEventAny) -> Result<()>
fn update_order(&self, _order_event: &OrderEventAny) -> Result<()>
Updates an order in the cache with an order event. Read more
Source§fn update_position(&self, _position: &Position) -> Result<()>
fn update_position(&self, _position: &Position) -> Result<()>
Updates a position in the cache. Read more
Source§fn snapshot_order_state(&self, _order: &OrderAny) -> Result<()>
fn snapshot_order_state(&self, _order: &OrderAny) -> Result<()>
Creates a snapshot of order state. Read more
Source§fn snapshot_position_state(
&self,
_position: &Position,
_ts_snapshot: UnixNanos,
_unrealized_pnl: Option<Money>,
) -> Result<()>
fn snapshot_position_state( &self, _position: &Position, _ts_snapshot: UnixNanos, _unrealized_pnl: Option<Money>, ) -> Result<()>
Creates a snapshot of position state. Read more
Source§fn heartbeat(&self, _timestamp: UnixNanos) -> Result<()>
fn heartbeat(&self, _timestamp: UnixNanos) -> Result<()>
Records a heartbeat timestamp. Read more
Source§fn load_greeks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<InstrumentId, GreeksData>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn load_greeks<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<InstrumentId, GreeksData>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Loads all
GreeksData from the cache. Read moreSource§fn load_yield_curves<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<String, YieldCurveData>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
fn load_yield_curves<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<AHashMap<String, YieldCurveData>, Error>> + Send + 'async_trait>>where
'life0: 'async_trait,
Self: Sync + 'async_trait,
Loads all
YieldCurveData from the cache. Read moreAuto Trait Implementations§
impl Freeze for TestCacheDatabase
impl RefUnwindSafe for TestCacheDatabase
impl Send for TestCacheDatabase
impl Sync for TestCacheDatabase
impl Unpin for TestCacheDatabase
impl UnsafeUnpin for TestCacheDatabase
impl UnwindSafe for TestCacheDatabase
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
Mutably borrows from an owned value. Read more