From 896af55e79f7b7dcef0a151f2a7df08a020c8dfa Mon Sep 17 00:00:00 2001 From: taha afzal Date: Tue, 24 May 2022 12:24:29 -0400 Subject: [PATCH] Added commented to document flow of ExchangePosition --- .../orderman/gateways/EMExecutionGateway.h | 27 ++++++++++++------- 1 file changed, 18 insertions(+), 9 deletions(-) diff --git a/src/lib/orderman/gateways/EMExecutionGateway.h b/src/lib/orderman/gateways/EMExecutionGateway.h index 89331a721..7245bc718 100644 --- a/src/lib/orderman/gateways/EMExecutionGateway.h +++ b/src/lib/orderman/gateways/EMExecutionGateway.h @@ -15,15 +15,24 @@ // IEMOrderMuxer through which all orders are sent out and callbacks reveived to // the and from the outside world. -// Callbacks are send back to the OrderManager via the 4 callback functions. The -// path that ExchangePosition takes to the OrderService is as follows: -// IEMOrderMuxer -> EMExecutionGateway (in IEMOrderMuxer's thread, IEMOrderMuxer -// exposes exchange_position_update_cb that EMExecutionGateway sets to its own -// function) EMExecutionGateway -> OrderManager (via -// on_exchange_position_state, which is exposed by EMExecutionGateway that -// OrderManager sets to its own callback function) OrderManager -> ServiceBridge -// (via Stream) ServiceBridge -> OrderServiceServer (via -// callback passed in ServiceBridge's constructor) +// Callbacks are sent back to the OrderManager via the 4 callback functions. + +// The path that ExchangePosition takes to the OrderService is as follows: +// 1. IEMOrderMuxer -> EMExecutionGateway (data: const +// std::vector) +// 2. EMExecutionGateway -> OrderManager (ExchangePosition) +// (the above 2 are implemented via the source exposing an std::func that the +// destination sets to its own function, ex, EMExecutionGateway doing this: +// me->order_mux->exchange_position_update_cb() = []() { ... } +// and OrderManager doing this: +// s->gw->on_exchange_position_state() =[](){ ... } +// 3. OrderManager -> ServiceBridge (via publishing +// Stream) +// 4. ServiceBridge -> OrderServiceServer (via callback passed in +// ServiceBridge's constructor) +// (ServiceBridge is constructed by the OrderServiceServer. It listens to the +// event published by the OrderManager, and calls the lambda passed by the +// OrderServiceServer wihle constructing OrderManager) namespace emumba::deribit_connector::data_types { class error;