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
@@ -61,26 +61,6 @@ datetime::Date sec_expiration_cut_off() {
|
||||
return datetime::Date(pt.date().year(), pt.date().month(), pt.date().day());
|
||||
}
|
||||
|
||||
void apply_compatibilit_mutations(Security &security) {
|
||||
// Migrate from old tick stuff
|
||||
if (security.has_glbx()) {
|
||||
if (security.has_glbx()) {
|
||||
if (security.contract_spec().main_fraction() == 0) {
|
||||
security.mutable_contract_spec()->set_main_fraction(
|
||||
security.glbx().do_not_use_main_fraction());
|
||||
}
|
||||
if (security.contract_spec().sub_fraction() == 0) {
|
||||
security.mutable_contract_spec()->set_sub_fraction(
|
||||
security.glbx().do_not_use_sub_fraction());
|
||||
}
|
||||
if (security.contract_spec().price_display_format() == 0) {
|
||||
security.mutable_contract_spec()->set_price_display_format(
|
||||
security.glbx().do_not_use_price_display_format());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
size_t load_securities(
|
||||
std::function<bool(const UserSymbol &symbo)> const &sym_filter,
|
||||
const std::function<void(const api::Security &)> &callback) {
|
||||
@@ -104,7 +84,6 @@ size_t load_securities(
|
||||
if (sym_filter(us)) {
|
||||
auto blob = select_stmt.getColumn("security_blob");
|
||||
if (security.ParseFromArray(blob, blob.getBytes())) {
|
||||
apply_compatibilit_mutations(security);
|
||||
bts_assert(security_key == security.id());
|
||||
count++;
|
||||
callback(security);
|
||||
@@ -146,7 +125,6 @@ SecurityPtr find_security(SecurityKey key) {
|
||||
auto result = std::make_shared<Security>();
|
||||
auto blob = select.getColumn(0);
|
||||
if (result->ParseFromArray(blob, blob.getBytes())) {
|
||||
apply_compatibilit_mutations(*result);
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user