| … | … | @@ -282,10 +282,6 @@ void MonoStorage::storeAtom(const Handle& h, bool synchronous) |
| 282 | 282 | // Separator for keys |
| 283 | 283 | std::string cid = "k@" + sid + ":"; |
| 284 | 284 | |
| 285 | // Always clobber the TV, set it back to default. | |
| 286 | // The below will revise as needed. | |
| 287 | _rfile->Delete(rocksdb::WriteOptions(), cid + tv_pred_sid); | |
| 288 | ||
| 289 | 285 | // Store all the keys on the atom ... |
| 290 | 286 | for (const Handle& key : h->getKeys()) |
| 291 | 287 | storeValue(cid + writeAtom(key), h->getValue(key)); |
| … | … | @@ -441,19 +437,7 @@ void MonoStorage::getKeys(AtomSpace* as, |
| 441 | 437 | } |
| 442 | 438 | |
| 443 | 439 | // read-only Atomspaces will refuse insertion of keys. |
| 444 | // However, we have to special-case the truth values. | |
| 445 | // Mostly because (PredicateNode "*-TruthValueKey-*") | |
| 446 | // is not in the AtomSpace. Argh! That's an old design flaw. | |
| 447 | if (nullptr == key) | |
| 448 | { | |
| 449 | if (0 == tv_pred_sid.compare(it->key().ToString().substr(pos))) | |
| 450 | { | |
| 451 | size_t junk = 0; | |
| 452 | ValuePtr vp = Sexpr::decode_value(it->value().ToString(), junk); | |
| 453 | h->setValue(truth_key(), vp); | |
| 454 | } | |
| 455 | continue; | |
| 456 | } | |
| 440 | if (nullptr == key) continue; | |
| 457 | 441 | |
| 458 | 442 | size_t junk = 0; |
| 459 | 443 | ValuePtr vp = Sexpr::decode_value(it->value().ToString(), junk); |
| … | … | @@ -163,13 +163,6 @@ void MonoStorage::init(const char * uri, bool read_only) |
| 163 | 163 | printf("Mono: opened=%s%s\n", file.c_str(), read_only ? " (read-only)" : ""); |
| 164 | 164 | printf("Mono: initial aid=%lu\n", _next_aid.load()); |
| 165 | 165 | |
| 166 | if (read_only) return; | |
| 167 | ||
| 168 | // Set up a SID for the TV predicate key. | |
| 169 | // This must match what the AtomSpace is using. | |
| 170 | // Tack on a leading colon, for convenience. | |
| 171 | Handle h = createNode(PREDICATE_NODE, "*-TruthValueKey-*"); | |
| 172 | tv_pred_sid = writeAtom(h); | |
| 173 | 166 | } |
| 174 | 167 | |
| 175 | 168 | void MonoStorage::open() |
| … | … | @@ -64,9 +64,6 @@ class MonoStorage : public StorageNode |
| 64 | 64 | std::string aidtostr(uint64_t) const; |
| 65 | 65 | void write_aid(void); |
| 66 | 66 | |
| 67 | // Special case (PredicateNode "*-TruthValueKey-*") | |
| 68 | std::string tv_pred_sid; | |
| 69 | ||
| 70 | 67 | // Issue of sid needs to be atomic. |
| 71 | 68 | std::mutex _mtx_sid; |
| 72 | 69 |
| … | … | @@ -389,10 +389,6 @@ void RocksStorage::storeAtom(const Handle& h, bool synchronous) |
| 389 | 389 | _rfile->Delete(rocksdb::WriteOptions(), marker); |
| 390 | 390 | } |
| 391 | 391 | |
| 392 | // Always clobber the TV, set it back to default. | |
| 393 | // The below will revise as needed. | |
| 394 | _rfile->Delete(rocksdb::WriteOptions(), cid + tv_pred_sid); | |
| 395 | ||
| 396 | 392 | // Store all the keys on the atom ... |
| 397 | 393 | for (const Handle& key : h->getKeys()) |
| 398 | 394 | storeValue(cid + writeAtom(key), h->getValue(key)); |
| … | … | @@ -405,10 +401,6 @@ void RocksStorage::storeMissingAtom(AtomSpace* as, const Handle& h) |
| 405 | 401 | // Separator for keys |
| 406 | 402 | std::string skid = "k@" + sid + ":" + writeFrame(as) + ":"; |
| 407 | 403 | |
| 408 | // Always clobber the TV, set it back to default. | |
| 409 | // The below will revise as needed. | |
| 410 | _rfile->Delete(rocksdb::WriteOptions(), skid + tv_pred_sid); | |
| 411 | ||
| 412 | 404 | // If there is a previous marker, erase it! |
| 413 | 405 | std::string marker = skid + "+1"; |
| 414 | 406 | _rfile->Delete(rocksdb::WriteOptions(), marker); |
| … | … | @@ -589,19 +581,7 @@ void RocksStorage::getKeysMonospace(AtomSpace* as, |
| 589 | 581 | } |
| 590 | 582 | |
| 591 | 583 | // read-only Atomspaces will refuse insertion of keys. |
| 592 | // However, we have to special-case the truth values. | |
| 593 | // Mostly because (PredicateNode "*-TruthValueKey-*") | |
| 594 | // is not in the AtomSpace. Argh! That's an old design flaw. | |
| 595 | if (nullptr == key) | |
| 596 | { | |
| 597 | if (0 == tv_pred_sid.compare(rks.substr(kidoff))) | |
| 598 | { | |
| 599 | size_t junk = 0; | |
| 600 | ValuePtr vp = Sexpr::decode_value(it->value().ToString(), junk); | |
| 601 | h->setValue(truth_key(), vp); | |
| 602 | } | |
| 603 | continue; | |
| 604 | } | |
| 584 | if (nullptr == key) continue; | |
| 605 | 585 | |
| 606 | 586 | size_t junk = 0; |
| 607 | 587 | ValuePtr vp = Sexpr::decode_value(it->value().ToString(), junk); |
| … | … | @@ -182,13 +182,6 @@ printf("Rocks: opened=%s%s\n", file.c_str(), read_only ? " (read-only)" : ""); |
| 182 | 182 | printf("Rocks: DB-version=%s multi-space=%d initial aid=%lu\n", |
| 183 | 183 | get_version().c_str(), _multi_space, _next_aid.load()); |
| 184 | 184 | |
| 185 | if (read_only) return; | |
| 186 | ||
| 187 | // Set up a SID for the TV predicate key. | |
| 188 | // This must match what the AtomSpace is using. | |
| 189 | // Tack on a leading colon, for convenience. | |
| 190 | Handle h = createNode(PREDICATE_NODE, "*-TruthValueKey-*"); | |
| 191 | tv_pred_sid = writeAtom(h); | |
| 192 | 185 | } |
| 193 | 186 | |
| 194 | 187 | void RocksStorage::open() |
| … | … | @@ -96,9 +96,6 @@ class RocksStorage : public StorageNode |
| 96 | 96 | void write_aid(void); |
| 97 | 97 | std::string get_new_aid(void); |
| 98 | 98 | |
| 99 | // Special case (PredicateNode "*-TruthValueKey-*") | |
| 100 | std::string tv_pred_sid; | |
| 101 | ||
| 102 | 99 | // Issue of sid needs to be atomic. |
| 103 | 100 | std::mutex _mtx_sid; |
| 104 | 101 |