libfoedus-core
FOEDUS Core Library
cache_manager_pimpl.hpp
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2014-2015, Hewlett-Packard Development Company, LP.
3  * This program is free software; you can redistribute it and/or modify it
4  * under the terms of the GNU General Public License as published by the Free
5  * Software Foundation; either version 2 of the License, or (at your option)
6  * any later version.
7  *
8  * This program is distributed in the hope that it will be useful, but WITHOUT
9  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11  * more details. You should have received a copy of the GNU General Public
12  * License along with this program; if not, write to the Free Software
13  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
14  *
15  * HP designates this particular file as subject to the "Classpath" exception
16  * as provided by HP in the LICENSE.txt file that accompanied this code.
17  */
18 #ifndef FOEDUS_CACHE_CACHE_MANAGER_PIMPL_HPP_
19 #define FOEDUS_CACHE_CACHE_MANAGER_PIMPL_HPP_
20 
21 #include <atomic>
22 #include <string>
23 #include <thread>
24 
25 #include "foedus/fwd.hpp"
26 #include "foedus/initializable.hpp"
27 #include "foedus/cache/fwd.hpp"
30 
31 namespace foedus {
32 namespace cache {
45  public:
46  CacheManagerPimpl() = delete;
47  explicit CacheManagerPimpl(Engine* engine);
48  ErrorStack initialize_once() override;
49  ErrorStack uninitialize_once() override;
50 
51  std::string describe() const;
52 
54  void handle_cleaner();
59  void handle_cleaner_evict_pages(uint64_t target_count);
60 
62 
63  Engine* const engine_;
64 
70  std::thread cleaner_;
71  uint64_t total_pages_;
77  std::atomic<bool> stop_requested_;
78 
86 
94 
107 
110 
113 };
114 } // namespace cache
115 } // namespace foedus
116 #endif // FOEDUS_CACHE_CACHE_MANAGER_PIMPL_HPP_
memory::PagePoolOffset * reclaimed_pages_
This buffers pages being reclaimed.
Page pool for volatile read/write store (VolatilePage) and the read-only bufferpool (SnapshotPage)...
Definition: page_pool.hpp:173
CacheHashtable * hashtable_
The cache hashtable (SnapshotPageId -> offset in pool) on top of the page pool.
Root package of FOEDUS (Fast Optimistic Engine for Data Unification Services).
Definition: assert_nd.hpp:44
uint32_t PagePoolOffset
Offset in PagePool that compactly represents the page address (unlike 8 bytes pointer).
Definition: memory_id.hpp:44
Forward declarations of classes in root package.
Brings error stacktrace information as return value of functions.
Definition: error_stack.hpp:81
Typical implementation of Initializable as a skeleton base class.
std::atomic< bool > stop_requested_
to stop cleaner_
uint64_t urgent_threshold_
the number of allocated pages above which cleaner advances epoch to release pages ...
Forward declarations of classes in cache package.
memory::PagePool * pool_
The SOC-local snapshot page pool in this SOC engine.
memory::AlignedMemory reclaimed_pages_memory_
The memory backing reclaimed_pages_.
void handle_cleaner_evict_pages(uint64_t target_count)
Evicts pages up to about target_count (maybe a bit more or less).
std::thread cleaner_
The only cleaner thread in this SOC engine.
Database engine object that holds all resources and provides APIs.
Definition: engine.hpp:109
Pimpl object of CacheManager.
A NUMA-local hashtable of cached snapshot pages.
Represents one memory block aligned to actual OS/hardware pages.
uint64_t reclaimed_pages_count_
Number of pages buffered so far.
void handle_cleaner()
Main routine of cleaner_.
uint64_t cleaner_threshold_
the number of allocated pages above which cleaner starts cleaning