SPARK-1951 Add SecurityCache access to QueryServer
This commit is contained in:
1 parent
e36729814a
commit
2020f6af6d
5 files changed
+34
-5
No files matched your search
@@ -388,6 +388,16 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
void get_securities(google::protobuf::RepeatedField<security_key> keys, api::SecurityList* result) const {
|
||||
bts_assert(result);
|
||||
for (auto k : keys) {
|
||||
auto ptr = _consumer.get_security(SecurityKey(k));
|
||||
if (ptr) {
|
||||
result->add_security()->CopyFrom(*ptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
struct MDRelayServer : bts::co2::AuthenticatedMarketDataRelayBase {
|
||||
@@ -474,6 +484,15 @@ struct MDRelayServer : bts::co2::AuthenticatedMarketDataRelayBase {
|
||||
reply(*preply);
|
||||
});
|
||||
}
|
||||
|
||||
virtual void get_securities(const api::AuthToken&, const SecurityKeyList& keys, const std::function<void(const api::SecurityList&)>& reply) override {
|
||||
_threadpool.post([=]() {
|
||||
google::protobuf::Arena arena;
|
||||
api::SecurityList* preply = google::protobuf::Arena::CreateMessage<api::SecurityList>(&arena);
|
||||
_db.get_securities(keys.keys(), preply);
|
||||
reply(*preply);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
struct QueryServer {
|
||||
|
||||
Reference in new issue
Block a user