refactor: Return row id in IStore::retrieve_one
This is a prerequisite to synchronizing security ids stored via IDGenerator (the "new" way to store ids, added when we implemented Deribit), and SecurityDB (the original way from spark days). The problem was that these 2 implementations were using separate databases. We need to unify the interfaces between these storage services to avoid breaking existing code.
This commit is contained in:
1 parent
cb187e6997
commit
bd8c97244a
28 files changed
+719
-566
No files matched your search
@@ -293,9 +293,9 @@ void PositionServiceServer::update_manual_fill(
|
||||
auto *this_resp = resp.add_response();
|
||||
auto id = std::to_string(mf.record_id());
|
||||
|
||||
auto p = me->manual_fills_store->retrieve_one(manual_fills_ns, id);
|
||||
auto found = p.first;
|
||||
if (!found) {
|
||||
auto [exists, rowid, val] =
|
||||
me->manual_fills_store->retrieve_one(manual_fills_ns, id);
|
||||
if (!exists) {
|
||||
this_resp->set_ok(false);
|
||||
this_resp->set_msg("Could not find record");
|
||||
} else {
|
||||
@@ -326,9 +326,9 @@ void PositionServiceServer::remove_manual_fill(
|
||||
auto *this_resp = resp.add_response();
|
||||
auto id = std::to_string(mf.record_id());
|
||||
|
||||
auto p = me->manual_fills_store->retrieve_one(manual_fills_ns, id);
|
||||
auto found = p.first;
|
||||
if (!found) {
|
||||
auto [exists, rowid, val] =
|
||||
me->manual_fills_store->retrieve_one(manual_fills_ns, id);
|
||||
if (!exists) {
|
||||
this_resp->set_ok(false);
|
||||
this_resp->set_msg("Could not find record");
|
||||
} else {
|
||||
@@ -367,10 +367,9 @@ void PositionServiceServer::update_security_parameters(
|
||||
req.op_params_size());
|
||||
for (const auto &p : req.op_params()) {
|
||||
std::string key_str = std::to_string(p.security_key());
|
||||
auto db_p =
|
||||
auto [exists, rowid, val] =
|
||||
me->security_params_store->retrieve_one(security_params_ns, key_str);
|
||||
auto found = db_p.first;
|
||||
if (!found) {
|
||||
if (!exists) {
|
||||
me->security_params_store->insert(
|
||||
security_params_ns, key_str, utils::pb::to_string(p));
|
||||
} else {
|
||||
|
||||
Reference in new issue
Block a user