[Groonga-commit] groonga/grnxx at c97797a [master] Voidify sweep().

Back to archive index

susumu.yata null+****@clear*****
Thu Jul 18 19:49:38 JST 2013


susumu.yata	2013-07-18 19:49:38 +0900 (Thu, 18 Jul 2013)

  New Revision: c97797a82a367a5885adcf4373b6a8bb0452570d
  https://github.com/groonga/grnxx/commit/c97797a82a367a5885adcf4373b6a8bb0452570d

  Message:
    Voidify sweep().

  Modified files:
    lib/grnxx/map/bytes_array.cpp
    lib/grnxx/map/bytes_array.hpp
    lib/grnxx/map/bytes_pool.cpp
    lib/grnxx/map/bytes_pool.hpp
    test/test_map.cpp

  Modified: lib/grnxx/map/bytes_array.cpp (+2 -2)
===================================================================
--- lib/grnxx/map/bytes_array.cpp    2013-07-18 19:40:55 +0900 (98a7a0b)
+++ lib/grnxx/map/bytes_array.cpp    2013-07-18 19:49:38 +0900 (aaaca01)
@@ -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()

  Modified: lib/grnxx/map/bytes_array.hpp (+1 -1)
===================================================================
--- lib/grnxx/map/bytes_array.hpp    2013-07-18 19:40:55 +0900 (40c7e49)
+++ lib/grnxx/map/bytes_array.hpp    2013-07-18 19:49:38 +0900 (125a808)
@@ -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_;

  Modified: lib/grnxx/map/bytes_pool.cpp (+3 -4)
===================================================================
--- lib/grnxx/map/bytes_pool.cpp    2013-07-18 19:40:55 +0900 (151f9e9)
+++ lib/grnxx/map/bytes_pool.cpp    2013-07-18 19:49:38 +0900 (d00b89c)
@@ -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() {}

  Modified: lib/grnxx/map/bytes_pool.hpp (+1 -1)
===================================================================
--- lib/grnxx/map/bytes_pool.hpp    2013-07-18 19:40:55 +0900 (8574175)
+++ lib/grnxx/map/bytes_pool.hpp    2013-07-18 19:49:38 +0900 (4ede058)
@@ -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_;

  Modified: test/test_map.cpp (+2 -2)
===================================================================
--- test/test_map.cpp    2013-07-18 19:40:55 +0900 (af0e8bd)
+++ test/test_map.cpp    2013-07-18 19:49:38 +0900 (6493f91)
@@ -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() {
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index