Crazy template stuff.
This commit is contained in:
1 parent
26bdef7ddd
commit
88a4d2ed80
5 files changed
+298
-100
No files matched your search
@@ -1 +1 @@
|
||||
set(sources algo/AlgoDefinitionServiceServer.cpp;cmds/AdminReport.cpp;cmds/AutoCert.cpp;cmds/Benchmark.cpp;cmds/CMECertCmd.cpp;cmds/CmdRegistry.cpp;cmds/ConfigCheck.cpp;cmds/FIXSim.cpp;cmds/Help.cpp;cmds/KeyCode.cpp;cmds/Md.cpp;cmds/ParseHistoricalFIX.cpp;cmds/PrintHedgeOrders.cpp;cmds/QuickTest.cpp;cmds/Run.cpp;cmds/Span.cpp;cmds/Spartan.cpp;cmds/Test.cpp;cmds/Web.cpp;cmds/spartan/algo/RunTAS.cpp;cmds/spartan/algo/TASOrderReactor.cpp;cmds/spartan/algo/TASTriggerDef.cpp;cmds/spartan/analysis/ActionableEventAnalyzer.cpp;cmds/spartan/analysis/RunAnalysis.cpp;cmds/spartan/md/cme/IMDP3FeedController.cpp;cmds/spartan/md/cme/MDP3FeedHandler.cpp;cmds/spartan/util/MCastReceiver.cpp;cmds/spartan/util/PCapReader.cpp;cmds/spartan/util/SecurityDB.cpp;dspark/mirage/quick_queue/quick_queue.cpp;exchange_sim/ExchangeSim.cpp;exchange_sim/ExchangeSimApplication.cpp;exchange_sim/book/Book.cpp;exchange_sim/book/ExchangeSim.proto;exchange_sim/book/Order.cpp;exchange_sim/book/OrderMatcher.cpp;exchange_sim/book/book_transform.cpp;exchange_sim/tests/test_book_transform.cpp;http/ApiGateway.cpp;http/MultipartFormDecoder.cpp;http/WebServer.cpp;http/tests/MultiPartFormTests.cpp;main.cpp;md/ChannelVolume.cpp;md/MarketDataAuxiliaryServiceServer.cpp;md/VolumeAtPriceState.cpp;md/platforms/IMDPlatform.cpp;md/platforms/ice_onixs/ICEListener.cpp;md/platforms/ice_onixs/ICEMain.cpp;md/platforms/ice_onixs/tests/ice_tests.cpp;md/platforms/mdp3_onixs/MDP3Listener.cpp;md/platforms/mdp3_onixs/MDP3Main.cpp;md/platforms/mdp3_onixs/tests/mdp3_tests.cpp;md/run_md.cpp;position/IPositionObserver.cpp;position/MarginServiceCore.cpp;position/MarginServiceServer.cpp;position/PositionAggregator.cpp;position/PositionMap.cpp;position/PositionServicePNLHelper.cpp;position/PositionServiceServer.cpp;position/import/BasePositionServiceServer.cpp;position/import/DownloadCommonStateMachine.cpp;position/import/DownloadWindow.cpp;position/import/MoneyFileServiceServer.cpp;position/import/parsing/gmi_parser.cpp;position/import/parsing/money_parser.cpp;position/import/parsing/parser_common.cpp;position/tests/PositionTests.cpp;position/tests/position_tests_internal.cpp;subprocess/SubProcessRunner.cpp;support/ErrorReportService.cpp;support/ShellLatencyServer.cpp;user/AdminServiceDB.cpp;user/AdminServiceServer.cpp;user/AuthServiceServer.cpp;user/tests/admin_service_tests.cpp)
|
||||
set(sources algo/AlgoDefinitionServiceServer.cpp;cmds/AdminReport.cpp;cmds/AutoCert.cpp;cmds/Benchmark.cpp;cmds/CMECertCmd.cpp;cmds/CmdRegistry.cpp;cmds/ConfigCheck.cpp;cmds/FIXSim.cpp;cmds/Help.cpp;cmds/KeyCode.cpp;cmds/Md.cpp;cmds/ParseHistoricalFIX.cpp;cmds/PrintHedgeOrders.cpp;cmds/QuickTest.cpp;cmds/Run.cpp;cmds/Span.cpp;cmds/Spartan.cpp;cmds/Test.cpp;cmds/Web.cpp;cmds/spartan/algo/RunTAS.cpp;cmds/spartan/algo/TASOrderReactor.cpp;cmds/spartan/algo/TASTriggerDef.cpp;cmds/spartan/analysis/ActionableEventAnalyzer.cpp;cmds/spartan/analysis/RunAnalysis.cpp;cmds/spartan/md/cme/ExperimentalMD.cpp;cmds/spartan/md/cme/IMDP3FeedController.cpp;cmds/spartan/md/cme/MDP3FeedHandler.cpp;cmds/spartan/util/MCastReceiver.cpp;cmds/spartan/util/PCapReader.cpp;cmds/spartan/util/SecurityDB.cpp;dspark/mirage/quick_queue/quick_queue.cpp;exchange_sim/ExchangeSim.cpp;exchange_sim/ExchangeSimApplication.cpp;exchange_sim/book/Book.cpp;exchange_sim/book/ExchangeSim.proto;exchange_sim/book/Order.cpp;exchange_sim/book/OrderMatcher.cpp;exchange_sim/book/book_transform.cpp;exchange_sim/tests/test_book_transform.cpp;http/ApiGateway.cpp;http/MultipartFormDecoder.cpp;http/WebServer.cpp;http/tests/MultiPartFormTests.cpp;main.cpp;md/ChannelVolume.cpp;md/MarketDataAuxiliaryServiceServer.cpp;md/VolumeAtPriceState.cpp;md/platforms/IMDPlatform.cpp;md/platforms/ice_onixs/ICEListener.cpp;md/platforms/ice_onixs/ICEMain.cpp;md/platforms/ice_onixs/tests/ice_tests.cpp;md/platforms/mdp3_onixs/MDP3Listener.cpp;md/platforms/mdp3_onixs/MDP3Main.cpp;md/platforms/mdp3_onixs/tests/mdp3_tests.cpp;md/run_md.cpp;position/IPositionObserver.cpp;position/MarginServiceCore.cpp;position/MarginServiceServer.cpp;position/PositionAggregator.cpp;position/PositionMap.cpp;position/PositionServicePNLHelper.cpp;position/PositionServiceServer.cpp;position/import/BasePositionServiceServer.cpp;position/import/DownloadCommonStateMachine.cpp;position/import/DownloadWindow.cpp;position/import/MoneyFileServiceServer.cpp;position/import/parsing/gmi_parser.cpp;position/import/parsing/money_parser.cpp;position/import/parsing/parser_common.cpp;position/tests/PositionTests.cpp;position/tests/position_tests_internal.cpp;subprocess/SubProcessRunner.cpp;support/ErrorReportService.cpp;support/ShellLatencyServer.cpp;user/AdminServiceDB.cpp;user/AdminServiceServer.cpp;user/AuthServiceServer.cpp;user/tests/admin_service_tests.cpp)
|
||||
@@ -0,0 +1,155 @@
|
||||
#include "ExperimentalMD.h"
|
||||
|
||||
#include "mdp3_gen/AdminHeartbeat12.h"
|
||||
#include "mdp3_gen/AdminLogin15.h"
|
||||
#include "mdp3_gen/AdminLogout16.h"
|
||||
#include "mdp3_gen/ChannelReset4.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshBook32.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshBook46.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshDailyStatistics33.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshDailyStatistics49.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshLimitsBanding34.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshLimitsBanding50.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshOrderBook43.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshOrderBook47.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshSessionStatistics35.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshSessionStatistics51.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshTradeSummary42.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshTradeSummary48.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshVolume37.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionFuture27.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionFuture54.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionOption41.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionOption55.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionSpread29.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionSpread56.h"
|
||||
#include "mdp3_gen/QuoteRequest39.h"
|
||||
#include "mdp3_gen/SecurityStatus30.h"
|
||||
#include "mdp3_gen/SnapshotFullRefresh38.h"
|
||||
#include "mdp3_gen/SnapshotFullRefresh52.h"
|
||||
#include "mdp3_gen/SnapshotFullRefreshOrderBook44.h"
|
||||
#include "mdp3_gen/SnapshotFullRefreshOrderBook53.h"
|
||||
#include "server/sparkd/cmds/spartan/md/cme/MDP3Parser.h"
|
||||
|
||||
namespace bts {
|
||||
namespace meta {
|
||||
|
||||
template <class... T> struct list;
|
||||
|
||||
template <typename Elem, typename List> struct cons;
|
||||
|
||||
template <typename Elem, typename... Ts> struct cons<Elem, list<Ts...>> {
|
||||
using type = list<Elem, Ts...>;
|
||||
};
|
||||
|
||||
template <template <typename> class Pred, typename List> struct filter;
|
||||
|
||||
template <template <typename> class Pred> struct filter<Pred, list<>> {
|
||||
using type = list<>;
|
||||
};
|
||||
|
||||
template <template <typename> class Pred, typename Head, typename... TailTs>
|
||||
struct filter<Pred, list<Head, TailTs...>> {
|
||||
using Tail = filter<Pred, list<TailTs...>>;
|
||||
using type = typename std::conditional<
|
||||
Pred<Head>::value, cons<Head, typename Tail::type>, Tail>::type::type;
|
||||
};
|
||||
|
||||
template <template <typename...> class Elem, class List> struct with_type_list;
|
||||
|
||||
template <template <typename...> class T, typename... Ts>
|
||||
struct with_type_list<T, list<Ts...>> {
|
||||
using type = T<Ts...>;
|
||||
};
|
||||
|
||||
} // namespace meta
|
||||
namespace spartan {
|
||||
namespace experimental {
|
||||
|
||||
using AllMDTypes = meta::list<
|
||||
mdp3::AdminLogin15, mdp3::AdminLogout16, mdp3::ChannelReset4,
|
||||
mdp3::MDIncrementalRefreshBook32, mdp3::MDIncrementalRefreshBook46,
|
||||
mdp3::MDIncrementalRefreshDailyStatistics33,
|
||||
mdp3::MDIncrementalRefreshDailyStatistics49,
|
||||
mdp3::MDIncrementalRefreshLimitsBanding34,
|
||||
mdp3::MDIncrementalRefreshLimitsBanding50,
|
||||
mdp3::MDIncrementalRefreshOrderBook43,
|
||||
mdp3::MDIncrementalRefreshOrderBook47,
|
||||
mdp3::MDIncrementalRefreshSessionStatistics35,
|
||||
mdp3::MDIncrementalRefreshSessionStatistics51,
|
||||
mdp3::MDIncrementalRefreshTradeSummary42,
|
||||
mdp3::MDIncrementalRefreshTradeSummary48,
|
||||
mdp3::MDIncrementalRefreshVolume37, mdp3::MDInstrumentDefinitionFuture27,
|
||||
mdp3::MDInstrumentDefinitionFuture54, mdp3::MDInstrumentDefinitionOption41,
|
||||
mdp3::MDInstrumentDefinitionOption55, mdp3::MDInstrumentDefinitionSpread29,
|
||||
mdp3::MDInstrumentDefinitionSpread56, mdp3::QuoteRequest39,
|
||||
mdp3::SecurityStatus30, mdp3::SnapshotFullRefresh38,
|
||||
mdp3::SnapshotFullRefresh52, mdp3::SnapshotFullRefreshOrderBook44,
|
||||
mdp3::SnapshotFullRefreshOrderBook53>;
|
||||
|
||||
template <class Handler, class Msg>
|
||||
using can_handle =
|
||||
std::is_invocable<Handler, MDP3PacketHeader const &, Msg const &>;
|
||||
|
||||
template <class Handler> struct extract_handled_msgs {
|
||||
template <class Msg>
|
||||
using can_this_handler_handle = can_handle<Handler, Msg>;
|
||||
using type =
|
||||
typename meta::filter<can_this_handler_handle, AllMDTypes>::type;
|
||||
};
|
||||
|
||||
template <class Handler, class... Msg> class ParserImpl {
|
||||
public:
|
||||
ParserImpl(Handler &h) : handler(h) {}
|
||||
|
||||
void on_bytes(std::string_view const &bytes) {
|
||||
MDP3PacketView packet(bytes);
|
||||
for (auto const &msg : packet)
|
||||
(try_handle<Msg>(packet, msg) || ...);
|
||||
}
|
||||
|
||||
private:
|
||||
Handler &handler;
|
||||
|
||||
template <class M>
|
||||
bool try_handle(MDP3PacketHeader const &ph, MDP3Msg const &msg) {
|
||||
if (msg.header().template_id == M::sbeTemplateId()) {
|
||||
handler(ph, M{(char *)msg.payload().data(), msg.payload().size()});
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
template <class Handler> class Parser {
|
||||
using HandledMsgs = typename extract_handled_msgs<Handler>::type;
|
||||
|
||||
using TypeListArgs = typename meta::cons<Handler, HandledMsgs>::type;
|
||||
|
||||
using RealParser =
|
||||
typename meta::with_type_list<ParserImpl, TypeListArgs>::type;
|
||||
|
||||
RealParser real_parser;
|
||||
|
||||
public:
|
||||
Parser(Handler &h) : real_parser(h) {}
|
||||
void on_bytes(std::string_view const &bytes) { real_parser.on_bytes(bytes); }
|
||||
};
|
||||
|
||||
struct MyHandler {
|
||||
void operator()(MDP3PacketHeader const &,
|
||||
mdp3::MDIncrementalRefreshOrderBook43 const &) {}
|
||||
void operator()(MDP3PacketHeader const &,
|
||||
mdp3::MDIncrementalRefreshOrderBook47 const &) {}
|
||||
};
|
||||
|
||||
|
||||
void f() {
|
||||
using MyParser = Parser<MyHandler>;
|
||||
MyHandler h;
|
||||
MyParser p(h);
|
||||
}
|
||||
|
||||
} // namespace experimental
|
||||
} // namespace spartan
|
||||
} // namespace bts
|
||||
@@ -0,0 +1,44 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../util/meta_type_pack.h"
|
||||
#include "mdp3_gen/AdminHeartbeat12.h"
|
||||
#include "mdp3_gen/AdminLogin15.h"
|
||||
#include "mdp3_gen/AdminLogout16.h"
|
||||
#include "mdp3_gen/ChannelReset4.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshBook32.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshBook46.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshDailyStatistics33.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshDailyStatistics49.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshLimitsBanding34.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshLimitsBanding50.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshOrderBook43.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshOrderBook47.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshSessionStatistics35.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshSessionStatistics51.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshTradeSummary42.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshTradeSummary48.h"
|
||||
#include "mdp3_gen/MDIncrementalRefreshVolume37.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionFuture27.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionFuture54.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionOption41.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionOption55.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionSpread29.h"
|
||||
#include "mdp3_gen/MDInstrumentDefinitionSpread56.h"
|
||||
#include "mdp3_gen/QuoteRequest39.h"
|
||||
#include "mdp3_gen/SecurityStatus30.h"
|
||||
#include "mdp3_gen/SnapshotFullRefresh38.h"
|
||||
#include "mdp3_gen/SnapshotFullRefresh52.h"
|
||||
#include "mdp3_gen/SnapshotFullRefreshOrderBook44.h"
|
||||
#include "mdp3_gen/SnapshotFullRefreshOrderBook53.h"
|
||||
|
||||
#include "lib/utils/bts_assert.h"
|
||||
#include "server/sparkd/cmds/spartan/md/cme/MDP3Parser.h"
|
||||
|
||||
#include <limits>
|
||||
|
||||
namespace bts {
|
||||
namespace spartan {
|
||||
|
||||
|
||||
}}
|
||||
@@ -1,107 +1,107 @@
|
||||
#include "MDP3FeedHandler.h"
|
||||
#include "IMDP3FeedController.h"
|
||||
// #include "MDP3FeedHandler.h"
|
||||
// #include "IMDP3FeedController.h"
|
||||
|
||||
namespace bts {
|
||||
namespace spartan {
|
||||
// namespace bts {
|
||||
// namespace spartan {
|
||||
|
||||
MDP3FeedHandler::MDP3FeedHandler(IMDP3FeedController &c, IMDP3FeedListener &l)
|
||||
: me(c, l) {
|
||||
me.instrument_snapshot.reserve(2048);
|
||||
me.book_snapshot.reserve(2048);
|
||||
me.incremental_queued.reserve(2048);
|
||||
}
|
||||
// MDP3FeedHandler::MDP3FeedHandler(IMDP3FeedController &c, IMDP3FeedListener &l)
|
||||
// : me(c, l) {
|
||||
// me.instrument_snapshot.reserve(2048);
|
||||
// me.book_snapshot.reserve(2048);
|
||||
// me.incremental_queued.reserve(2048);
|
||||
// }
|
||||
|
||||
void MDP3FeedHandler::start() {
|
||||
bts_assert(me.state == State::STOPPED);
|
||||
me.controller.start_incremental_feeds();
|
||||
me.controller.start_instrument_feed();
|
||||
transition(State::RECOVERING_INSTRUMENTS);
|
||||
}
|
||||
// void MDP3FeedHandler::start() {
|
||||
// bts_assert(me.state == State::STOPPED);
|
||||
// me.controller.start_incremental_feeds();
|
||||
// me.controller.start_instrument_feed();
|
||||
// transition(State::RECOVERING_INSTRUMENTS);
|
||||
// }
|
||||
|
||||
void MDP3FeedHandler::stop() {
|
||||
switch (me.state) {
|
||||
case State::STOPPED:
|
||||
bts_assert(false);
|
||||
break;
|
||||
case State::RECOVERING_INSTRUMENTS:
|
||||
me.controller.stop_incremental_feeds();
|
||||
me.controller.stop_instrument_feed();
|
||||
cleanup_recovery();
|
||||
break;
|
||||
case State::RECOVERING_BOOKS:
|
||||
me.controller.stop_incremental_feeds();
|
||||
me.controller.stop_recovery_feed();
|
||||
cleanup_recovery();
|
||||
break;
|
||||
case State::SYNCHED:
|
||||
me.controller.stop_incremental_feeds();
|
||||
break;
|
||||
}
|
||||
transition(State::STOPPED);
|
||||
}
|
||||
// void MDP3FeedHandler::stop() {
|
||||
// switch (me.state) {
|
||||
// case State::STOPPED:
|
||||
// bts_assert(false);
|
||||
// break;
|
||||
// case State::RECOVERING_INSTRUMENTS:
|
||||
// me.controller.stop_incremental_feeds();
|
||||
// me.controller.stop_instrument_feed();
|
||||
// cleanup_recovery();
|
||||
// break;
|
||||
// case State::RECOVERING_BOOKS:
|
||||
// me.controller.stop_incremental_feeds();
|
||||
// me.controller.stop_recovery_feed();
|
||||
// cleanup_recovery();
|
||||
// break;
|
||||
// case State::SYNCHED:
|
||||
// me.controller.stop_incremental_feeds();
|
||||
// break;
|
||||
// }
|
||||
// transition(State::STOPPED);
|
||||
// }
|
||||
|
||||
void MDP3FeedHandler::on_incremental_feed(std::string_view const *bytes_A,
|
||||
std::string_view const *bytes_B) {
|
||||
switch (me.state) {
|
||||
case State::STOPPED:
|
||||
break;
|
||||
case State::RECOVERING_INSTRUMENTS:
|
||||
if (!maybe_queue_incremental(bytes_A) &&
|
||||
!maybe_queue_incremental(bytes_B)) {
|
||||
LOG(Spartan, Error,
|
||||
"Gapped while recovering instruments. Starting over");
|
||||
cleanup_recovery();
|
||||
transition(State::RECOVERING_INSTRUMENTS);
|
||||
} else
|
||||
maybe_start_book_recovery();
|
||||
break;
|
||||
case State::RECOVERING_BOOKS:
|
||||
if (!maybe_queue_incremental(bytes_A) &&
|
||||
!maybe_queue_incremental(bytes_B)) {
|
||||
LOG(Spartan, Error, "Gapped while recovering books. Starting over");
|
||||
cleanup_recovery();
|
||||
transition(State::RECOVERING_INSTRUMENTS);
|
||||
}
|
||||
break;
|
||||
case State::SYNCHED:
|
||||
if (maybe_forward_incremental(bytes_A))
|
||||
return;
|
||||
if (maybe_forward_incremental(bytes_B))
|
||||
return;
|
||||
// void MDP3FeedHandler::on_incremental_feed(std::string_view const *bytes_A,
|
||||
// std::string_view const *bytes_B) {
|
||||
// switch (me.state) {
|
||||
// case State::STOPPED:
|
||||
// break;
|
||||
// case State::RECOVERING_INSTRUMENTS:
|
||||
// if (!maybe_queue_incremental(bytes_A) &&
|
||||
// !maybe_queue_incremental(bytes_B)) {
|
||||
// LOG(Spartan, Error,
|
||||
// "Gapped while recovering instruments. Starting over");
|
||||
// cleanup_recovery();
|
||||
// transition(State::RECOVERING_INSTRUMENTS);
|
||||
// } else
|
||||
// maybe_start_book_recovery();
|
||||
// break;
|
||||
// case State::RECOVERING_BOOKS:
|
||||
// if (!maybe_queue_incremental(bytes_A) &&
|
||||
// !maybe_queue_incremental(bytes_B)) {
|
||||
// LOG(Spartan, Error, "Gapped while recovering books. Starting over");
|
||||
// cleanup_recovery();
|
||||
// transition(State::RECOVERING_INSTRUMENTS);
|
||||
// }
|
||||
// break;
|
||||
// case State::SYNCHED:
|
||||
// if (maybe_forward_incremental(bytes_A))
|
||||
// return;
|
||||
// if (maybe_forward_incremental(bytes_B))
|
||||
// return;
|
||||
|
||||
LOG(Spartan, Error, "Gapped while processing real time feed. Starting recovery");
|
||||
me.controller.start_instrument_feed();
|
||||
me.controller.start_recovery_feed();
|
||||
transition(State::RECOVERING_INSTRUMENTS);
|
||||
break;
|
||||
}
|
||||
}
|
||||
// LOG(Spartan, Error, "Gapped while processing real time feed. Starting recovery");
|
||||
// me.controller.start_instrument_feed();
|
||||
// me.controller.start_recovery_feed();
|
||||
// transition(State::RECOVERING_INSTRUMENTS);
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
|
||||
bool MDP3FeedHandler::maybe_queue_incremental(std::string_view const *bytes) {
|
||||
if (bytes) {
|
||||
MDP3PacketView new_packet(*bytes);
|
||||
if (me.incremental_queued.empty() ||
|
||||
me.incremental_queued.back().header().msg_seq_num + 1 ==
|
||||
new_packet.header().msg_seq_num) {
|
||||
auto bp = me.recovery_pool.construct(new_packet);
|
||||
me.instrument_snapshot.push_back(bp->view());
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// bool MDP3FeedHandler::maybe_queue_incremental(std::string_view const *bytes) {
|
||||
// if (bytes) {
|
||||
// MDP3PacketView new_packet(*bytes);
|
||||
// if (me.incremental_queued.empty() ||
|
||||
// me.incremental_queued.back().header().msg_seq_num + 1 ==
|
||||
// new_packet.header().msg_seq_num) {
|
||||
// auto bp = me.recovery_pool.construct(new_packet);
|
||||
// me.instrument_snapshot.push_back(bp->view());
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
bool MDP3FeedHandler::maybe_forward_incremental(std::string_view const *bytes) {
|
||||
if (bytes) {
|
||||
MDP3PacketView new_packet(*bytes);
|
||||
if (new_packet.header().msg_seq_num == me.synched_sequence_number +1) {
|
||||
me.synched_sequence_number ++;
|
||||
me.parser.on_bytes(*bytes);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
// bool MDP3FeedHandler::maybe_forward_incremental(std::string_view const *bytes) {
|
||||
// if (bytes) {
|
||||
// MDP3PacketView new_packet(*bytes);
|
||||
// if (new_packet.header().msg_seq_num == me.synched_sequence_number +1) {
|
||||
// me.synched_sequence_number ++;
|
||||
// me.parser.on_bytes(*bytes);
|
||||
// return true;
|
||||
// }
|
||||
// }
|
||||
// return false;
|
||||
// }
|
||||
|
||||
} // namespace spartan
|
||||
} // namespace bts
|
||||
// } // namespace spartan
|
||||
// } // namespace bts
|
||||
@@ -1,4 +1,3 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "../../util/meta_type_pack.h"
|
||||
|
||||
Reference in new issue
Block a user