susumu.yata
null+****@clear*****
Thu Jul 18 18:30:01 JST 2013
susumu.yata 2013-07-18 18:30:01 +0900 (Thu, 18 Jul 2013) New Revision: a2fe5bb62456c8eb21b00d06dc6a0b1614108944 https://github.com/groonga/grnxx/commit/a2fe5bb62456c8eb21b00d06dc6a0b1614108944 Message: Add grnxx::map::BytesPool::get_page_size_in_use(). Modified files: lib/grnxx/map/bytes_pool.hpp Modified: lib/grnxx/map/bytes_pool.hpp (+11 -0) =================================================================== --- lib/grnxx/map/bytes_pool.hpp 2013-07-18 17:34:23 +0900 (3defb45) +++ lib/grnxx/map/bytes_pool.hpp 2013-07-18 18:30:01 +0900 (8574175) @@ -117,6 +117,17 @@ class BytesPool { // Add a byte sequence and return its ID. uint64_t add(ValueArg value); + // Return the actually used size of a page in use. + // If a page is not in use, return the page size. + uint64_t get_page_size_in_use(uint64_t page_id) { + const BytesPoolPageHeader &page_header = page_headers_->get_value(page_id); + if (page_header.status == BYTES_POOL_PAGE_IN_USE) { + return page_header.size_in_use; + } else { + return page_size(); + } + } + // Sweep empty pages whose modified time <= (now - lifetime). bool sweep(Duration lifetime); -------------- next part -------------- HTML����������������������������... Télécharger