0.9.8.10
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Classes | Public Types | Public Member Functions | Protected Attributes | Friends | List of all members
Hypertable::CellCache Class Reference

Represents a sorted list of key/value pairs in memory. More...

#include <CellCache.h>

Inheritance diagram for Hypertable::CellCache:
Inheritance graph
[legend]
Collaboration diagram for Hypertable::CellCache:
Collaboration graph
[legend]

Classes

struct  Statistics
 Holds cache statistics. More...
 

Public Types

typedef std::pair< const
SerializedKey, uint32_t > 
Value
 
typedef CellCacheAllocator< ValueAlloc
 
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)
 
CellCacheArenaarena ()
 
- 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
 

Detailed Description

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.

Member Typedef Documentation

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.

Constructor & Destructor Documentation

CellCache::CellCache ( )

Definition at line 41 of file CellCache.cc.

Hypertable::CellCache::CellCache ( CellCacheArena arena)
virtual Hypertable::CellCache::~CellCache ( )
inlinevirtual

Definition at line 68 of file CellCache.h.

Member Function Documentation

void CellCache::add ( const Key key,
const ByteString  value 
)
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

Parameters
keykey to be inserted
valuevalue to inserted

Implements Hypertable::CellList.

Definition at line 51 of file CellCache.cc.

void CellCache::add_counter ( const Key key,
const ByteString  value 
)
virtual

Definition at line 83 of file CellCache.cc.

void Hypertable::CellCache::add_statistics ( Statistics stats)
inline

Definition at line 116 of file CellCache.h.

CellCacheArena& Hypertable::CellCache::arena ( )
inline

Definition at line 140 of file CellCache.h.

CellListScannerPtr CellCache::create_scanner ( ScanContext scan_ctx)
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.

int32_t Hypertable::CellCache::delete_count ( )
inline

Definition at line 126 of file CellCache.h.

bool Hypertable::CellCache::empty ( )
inline

Definition at line 93 of file CellCache.h.

void Hypertable::CellCache::lock ( )
inline

Definition at line 88 of file CellCache.h.

int64_t Hypertable::CellCache::logical_size ( )
inline

Definition at line 111 of file CellCache.h.

uint64_t Hypertable::CellCache::memory_allocated ( )
inline

Returns the amount of memory allocated by the CellCache.

Definition at line 106 of file CellCache.h.

int64_t Hypertable::CellCache::memory_used ( )
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.

void Hypertable::CellCache::populate_key_set ( KeySet keys)
inline

Definition at line 131 of file CellCache.h.

size_t Hypertable::CellCache::size ( )
inline

Definition at line 91 of file CellCache.h.

void CellCache::split_row_estimate_data ( SplitRowDataMapT split_row_data)
overridevirtual

Populates split_row_data with unique row and count estimates for this list.

Parameters
split_row_dataReference to accumulator map holding estimate of unique rows and counts.
Note
split_row_data should not be cleared

Reimplemented from Hypertable::CellList.

Definition at line 170 of file CellCache.cc.

void Hypertable::CellCache::unlock ( )
inline

Definition at line 89 of file CellCache.h.

Friends And Related Function Documentation

friend class CellCacheScanner
friend

Definition at line 142 of file CellCache.h.

Member Data Documentation

CellCacheArena Hypertable::CellCache::m_arena
protected

Definition at line 152 of file CellCache.h.

CellMap Hypertable::CellCache::m_cell_map
protected

Definition at line 153 of file CellCache.h.

int32_t Hypertable::CellCache::m_collisions {}
protected

Definition at line 155 of file CellCache.h.

int32_t Hypertable::CellCache::m_deletes {}
protected

Definition at line 154 of file CellCache.h.

bool Hypertable::CellCache::m_have_counter_deletes {}
protected

Definition at line 158 of file CellCache.h.

int64_t Hypertable::CellCache::m_key_bytes {}
protected

Definition at line 156 of file CellCache.h.

std::mutex Hypertable::CellCache::m_mutex
protected

Definition at line 151 of file CellCache.h.

int64_t Hypertable::CellCache::m_value_bytes {}
protected

Definition at line 157 of file CellCache.h.


The documentation for this class was generated from the following files: