diff --git a/lib/grnxx/map/bytes_array.cpp b/lib/grnxx/map/bytes_array.cpp index 98a7a0b..aaaca01 100644 --- a/lib/grnxx/map/bytes_array.cpp +++ b/lib/grnxx/map/bytes_array.cpp @@ -110,8 +110,8 @@ void BytesArray::set(uint64_t value_id, ValueArg value) { *src_bytes_id = dest_bytes_id; } -bool BytesArray::sweep(Duration lifetime) { - return pool_->sweep(lifetime); +void BytesArray::sweep(Duration lifetime) { + pool_->sweep(lifetime); } BytesArray::BytesArray() diff --git a/lib/grnxx/map/bytes_array.hpp b/lib/grnxx/map/bytes_array.hpp index 40c7e49..125a808 100644 --- a/lib/grnxx/map/bytes_array.hpp +++ b/lib/grnxx/map/bytes_array.hpp @@ -75,7 +75,7 @@ class BytesArray { void set(uint64_t value_id, ValueArg value); // Sweep empty pages whose modified time < (now - lifetime). - bool sweep(Duration lifetime); + void sweep(Duration lifetime); private: Storage *storage_; diff --git a/lib/grnxx/map/bytes_pool.cpp b/lib/grnxx/map/bytes_pool.cpp index 151f9e9..d00b89c 100644 --- a/lib/grnxx/map/bytes_pool.cpp +++ b/lib/grnxx/map/bytes_pool.cpp @@ -203,10 +203,10 @@ uint64_t BytesPool::add(ValueArg value) { return get_value_id(offset, size); } -bool BytesPool::sweep(Duration lifetime) { +void BytesPool::sweep(Duration lifetime) { if (header_->latest_empty_page_id == INVALID_PAGE_ID) { // Nothing to do. - return true; + return; } BytesPoolPageHeader * const latest_empty_page_header = &page_headers_->get_value(header_->latest_empty_page_id); @@ -223,7 +223,7 @@ bool BytesPool::sweep(Duration lifetime) { } if (oldest_empty_page_header->modified_time > threshold) { // The remaining empty pages are not ready. - return true; + break; } const uint32_t next_oldest_empty_page_id = oldest_empty_page_header->next_page_id; @@ -234,7 +234,6 @@ bool BytesPool::sweep(Duration lifetime) { header_->latest_empty_page_id = INVALID_PAGE_ID; } } while (header_->latest_empty_page_id != INVALID_PAGE_ID); - return true; } BytesPool::~BytesPool() {} diff --git a/lib/grnxx/map/bytes_pool.hpp b/lib/grnxx/map/bytes_pool.hpp index 8574175..4ede058 100644 --- a/lib/grnxx/map/bytes_pool.hpp +++ b/lib/grnxx/map/bytes_pool.hpp @@ -129,7 +129,7 @@ class BytesPool { } // Sweep empty pages whose modified time <= (now - lifetime). - bool sweep(Duration lifetime); + void sweep(Duration lifetime); private: Storage *storage_; diff --git a/test/test_map.cpp b/test/test_map.cpp index af0e8bd..6493f91 100644 --- a/test/test_map.cpp +++ b/test/test_map.cpp @@ -247,7 +247,7 @@ void test_bytes_pool_sweep() { std::uint64_t key_id = pool->add(keys[i]); pool->unset(key_id); } - assert(pool->sweep(grnxx::Duration(0))); + pool->sweep(grnxx::Duration(0)); for (std::uint64_t i = 0; i < BYTES_POOL_NUM_KEYS; ++i) { std::uint64_t key_id = pool->add(keys[i]); key_ids.push_back(key_id); @@ -255,7 +255,7 @@ void test_bytes_pool_sweep() { for (std::uint64_t i = 0; i < BYTES_POOL_NUM_KEYS; ++i) { pool->unset(key_ids[i]); } - assert(pool->sweep(grnxx::Duration(0))); + pool->sweep(grnxx::Duration(0)); } void test_bytes_array_create() {