Represents a sorted list of key/value pairs in memory. More...
#include <CellCache.h>
Classes | |
struct | Statistics |
Holds cache statistics. More... | |
Public Types | |
typedef std::pair< const SerializedKey, uint32_t > | Value |
typedef CellCacheAllocator< Value > | Alloc |
typedef std::map< const SerializedKey, uint32_t, std::less< const SerializedKey > , Alloc > | CellMap |
Public Types inherited from Hypertable::CellList | |
typedef std::pair< const char *, int64_t > | SplitRowDataValue |
typedef StlAllocator < SplitRowDataValue > | SplitRowDataAlloc |
typedef std::map< const char *, int64_t, LtCstr, SplitRowDataAlloc > | SplitRowDataMapT |
Public Member Functions | |
CellCache () | |
CellCache (CellCacheArena &arena) | |
virtual | ~CellCache () |
void | add (const Key &key, const ByteString value) override |
Adds a key/value pair to the CellCache. More... | |
virtual void | add_counter (const Key &key, const ByteString value) |
void | split_row_estimate_data (SplitRowDataMapT &split_row_data) override |
Populates split_row_data with unique row and count estimates for this list. More... | |
CellListScannerPtr | create_scanner (ScanContext *scan_ctx) override |
Creates a CellCacheScanner object that contains an shared pointer to this CellCache. More... | |
void | lock () |
void | unlock () |
size_t | size () |
bool | empty () |
int64_t | memory_used () |
Returns the amount of memory used by the CellCache. More... | |
uint64_t | memory_allocated () |
Returns the amount of memory allocated by the CellCache. More... | |
int64_t | logical_size () |
void | add_statistics (Statistics &stats) |
int32_t | delete_count () |
void | populate_key_set (KeySet &keys) |
CellCacheArena & | arena () |
Public Member Functions inherited from Hypertable::CellList | |
virtual | ~CellList () |
virtual const char * | get_start_row () |
Returns the start row of this cell list. More... | |
virtual const char * | get_end_row () |
Returns the end row of this cell list. More... | |
Protected Attributes | |
std::mutex | m_mutex |
CellCacheArena | m_arena |
CellMap | m_cell_map |
int32_t | m_deletes {} |
int32_t | m_collisions {} |
int64_t | m_key_bytes {} |
int64_t | m_value_bytes {} |
bool | m_have_counter_deletes {} |
Protected Attributes inherited from Hypertable::CellList | |
std::string | m_start_row |
std::string | m_end_row |
Friends | |
class | CellCacheScanner |
Represents a sorted list of key/value pairs in memory.
All updates get written to the CellCache and later get "compacted" into a CellStore on disk.
Definition at line 52 of file CellCache.h.
Definition at line 145 of file CellCache.h.
typedef std::map<const SerializedKey, uint32_t, std::less<const SerializedKey>, Alloc> Hypertable::CellCache::CellMap |
Definition at line 147 of file CellCache.h.
typedef std::pair<const SerializedKey, uint32_t> Hypertable::CellCache::Value |
Definition at line 144 of file CellCache.h.
CellCache::CellCache | ( | ) |
Definition at line 41 of file CellCache.cc.
Hypertable::CellCache::CellCache | ( | CellCacheArena & | arena | ) |
|
inlinevirtual |
Definition at line 68 of file CellCache.h.
|
overridevirtual |
Adds a key/value pair to the CellCache.
This method assumes that the CellCache has been locked by a call to lock. Copies of the key and value are created and inserted into the underlying cell map
key | key to be inserted |
value | value to inserted |
Implements Hypertable::CellList.
Definition at line 51 of file CellCache.cc.
|
virtual |
Definition at line 83 of file CellCache.cc.
|
inline |
Definition at line 116 of file CellCache.h.
|
inline |
Definition at line 140 of file CellCache.h.
|
overridevirtual |
Creates a CellCacheScanner object that contains an shared pointer to this CellCache.
Reimplemented from Hypertable::CellList.
Definition at line 201 of file CellCache.cc.
|
inline |
Definition at line 126 of file CellCache.h.
|
inline |
Definition at line 93 of file CellCache.h.
|
inline |
Definition at line 88 of file CellCache.h.
|
inline |
Definition at line 111 of file CellCache.h.
|
inline |
Returns the amount of memory allocated by the CellCache.
Definition at line 106 of file CellCache.h.
|
inline |
Returns the amount of memory used by the CellCache.
This is the summation of the lengths of all the keys and values in the map.
Definition at line 98 of file CellCache.h.
|
inline |
Definition at line 131 of file CellCache.h.
|
inline |
Definition at line 91 of file CellCache.h.
|
overridevirtual |
Populates split_row_data
with unique row and count estimates for this list.
split_row_data | Reference to accumulator map holding estimate of unique rows and counts. |
split_row_data
should not be cleared Reimplemented from Hypertable::CellList.
Definition at line 170 of file CellCache.cc.
|
inline |
Definition at line 89 of file CellCache.h.
|
friend |
Definition at line 142 of file CellCache.h.
|
protected |
Definition at line 152 of file CellCache.h.
|
protected |
Definition at line 153 of file CellCache.h.
|
protected |
Definition at line 155 of file CellCache.h.
|
protected |
Definition at line 154 of file CellCache.h.
|
protected |
Definition at line 158 of file CellCache.h.
|
protected |
Definition at line 156 of file CellCache.h.
|
protected |
Definition at line 151 of file CellCache.h.
|
protected |
Definition at line 157 of file CellCache.h.