Add some temporary return data for security_names service
This commit is contained in:
1 parent
e8b4567e60
commit
7bf4abf38d
2 files changed
+23
-1
No files matched your search
@@ -1,6 +1,7 @@
|
||||
syntax="proto3";
|
||||
package bts.co2;
|
||||
option csharp_namespace="bts.co2";
|
||||
option cc_enable_arenas=true;
|
||||
import "lib/api/apioptions.proto";
|
||||
import "lib/api/apicore.proto";
|
||||
import "lib/domain_model/Security.proto";
|
||||
|
||||
@@ -312,6 +312,22 @@ public:
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void get_names(ExpirationNameList* reply) const {
|
||||
bts_assert(reply != nullptr);
|
||||
Security security;
|
||||
for (auto& groupiter : _groups) {
|
||||
const auto& group = groupiter.second;
|
||||
for(const auto& h : *(group->handles)) {
|
||||
security.CopyFrom(h.handle.get_normalized_security());
|
||||
auto x = reply->mutable_names();
|
||||
if (security.ExchangeData_case() == Security::kGlbx) {
|
||||
google::protobuf::MapPair<uint32_t,std::string> v(h.handle.key(), security.glbx().security_desc());
|
||||
x->insert(v);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
@@ -354,7 +370,12 @@ struct MDRelayServer : bts::co2::MarketDataRelayBase {
|
||||
}
|
||||
|
||||
virtual void request_names(const api::VoidMessage&, const std::function<void(const ExpirationNameList&)>& reply) override {
|
||||
(void)reply;
|
||||
_threadpool.post([=]() {
|
||||
google::protobuf::Arena arena;
|
||||
ExpirationNameList* preply = google::protobuf::Arena::CreateMessage<ExpirationNameList>(&arena);
|
||||
_db.get_names(preply);
|
||||
reply(*preply);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in new issue
Block a user