Fix formatting and a ASSERT_STATUS_CHECKED test failure

This commit is contained in:
anand76 2021-03-30 12:34:19 -07:00
parent 27ec9bc869
commit ecd3693770
2 changed files with 5 additions and 7 deletions

View File

@ -262,9 +262,7 @@ class TestNvmCache : public NvmCache {
TestNvmCacheHandle(Cache* cache, Cache::Handle* handle, void* value, TestNvmCacheHandle(Cache* cache, Cache::Handle* handle, void* value,
size_t size) size_t size)
: cache_(cache), handle_(handle), value_(value), size_(size) {} : cache_(cache), handle_(handle), value_(value), size_(size) {}
~TestNvmCacheHandle() { ~TestNvmCacheHandle() { cache_->Release(handle_); }
cache_->Release(handle_);
}
bool isReady() override { return true; } bool isReady() override { return true; }
@ -351,7 +349,7 @@ TEST_F(LRUCacheTest, TestNvmCache) {
std::string str2 = rnd.RandomString(1020); std::string str2 = rnd.RandomString(1020);
TestItem* item2 = new TestItem(str2.data(), str2.length()); TestItem* item2 = new TestItem(str2.data(), str2.length());
// k2 should be demoted to NVM // k2 should be demoted to NVM
cache->Insert("k2", item2, helper_cb, str2.length()); ASSERT_OK(cache->Insert("k2", item2, helper_cb, str2.length()));
Cache::Handle* handle; Cache::Handle* handle;
handle = cache->Lookup("k2", helper_cb, test_item_creator, handle = cache->Lookup("k2", helper_cb, test_item_creator,

View File

@ -175,7 +175,7 @@ class Cache {
// contiguous buffer, in which case this callback will be called multiple // contiguous buffer, in which case this callback will be called multiple
// times with increasing offset // times with increasing offset
typedef ROCKSDB_NAMESPACE::Status (*SaveToCallback)(void* obj, size_t offset, typedef ROCKSDB_NAMESPACE::Status (*SaveToCallback)(void* obj, size_t offset,
size_t size, void* out); size_t size, void* out);
// DeletionCallback is a function pointer that deletes the cached // DeletionCallback is a function pointer that deletes the cached
// object. The signature matches the old deleter function. // object. The signature matches the old deleter function.
@ -191,8 +191,8 @@ class Cache {
// takes in a buffer from the NVM cache and constructs an object using // takes in a buffer from the NVM cache and constructs an object using
// it. The callback doesn't have ownership of the buffer and should // it. The callback doesn't have ownership of the buffer and should
// copy the contents into its own buffer. // copy the contents into its own buffer.
typedef std::function<ROCKSDB_NAMESPACE::Status(void* buf, size_t size, typedef std::function<ROCKSDB_NAMESPACE::Status(
void** out_obj, size_t* charge)> void* buf, size_t size, void** out_obj, size_t* charge)>
CreateCallback; CreateCallback;
Cache(std::shared_ptr<MemoryAllocator> allocator = nullptr) Cache(std::shared_ptr<MemoryAllocator> allocator = nullptr)