Return a string that contains all key,value pairs in order, formatted like "(k1->v1)(k2->v2)".
| 337 | // Return a string that contains all key,value pairs in order, |
| 338 | // formatted like "(k1->v1)(k2->v2)". |
| 339 | std::string Contents() { |
| 340 | std::vector<std::string> forward; |
| 341 | std::string result; |
| 342 | Iterator* iter = db_->NewIterator(ReadOptions()); |
| 343 | for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { |
| 344 | std::string s = IterStatus(iter); |
| 345 | result.push_back('('); |
| 346 | result.append(s); |
| 347 | result.push_back(')'); |
| 348 | forward.push_back(s); |
| 349 | } |
| 350 | |
| 351 | // Check reverse iteration results are the reverse of forward results |
| 352 | size_t matched = 0; |
| 353 | for (iter->SeekToLast(); iter->Valid(); iter->Prev()) { |
| 354 | ASSERT_LT(matched, forward.size()); |
| 355 | ASSERT_EQ(IterStatus(iter), forward[forward.size() - matched - 1]); |
| 356 | matched++; |
| 357 | } |
| 358 | ASSERT_EQ(matched, forward.size()); |
| 359 | |
| 360 | delete iter; |
| 361 | return result; |
| 362 | } |
| 363 | |
| 364 | std::string AllEntriesFor(const Slice& user_key) { |
| 365 | Iterator* iter = dbfull()->TEST_NewInternalIterator(); |
nothing calls this directly
no test coverage detected