41 if (!m_immutable_cache)
44 if (m_immutable_cache->size() == 0) {
45 m_immutable_cache = 0;
49 if (m_active_cache->size() == 0) {
50 install_new_active_cache(m_immutable_cache);
51 m_immutable_cache = 0;
60 while (scanner->get(key, value)) {
61 merged_cache->add(key, value);
66 scanner = m_active_cache->create_scanner(scan_ctx.get());
67 while (scanner->get(key, value)) {
68 merged_cache->add(key, value);
71 install_new_active_cache(merged_cache);
72 m_immutable_cache = 0;
78 while (scanner->get(key, value)) {
79 m_active_cache->add(key, value);
86 if (m_immutable_cache)
87 mscanner->
add_scanner(m_immutable_cache->create_scanner(scan_ctx));
92 if (!m_active_cache->empty())
93 scanner->
add_scanner(m_active_cache->create_scanner(scan_ctx));
94 add_immutable_scanner(scanner, scan_ctx);
100 if (m_immutable_cache)
101 m_immutable_cache->split_row_estimate_data(split_row_data);
102 m_active_cache->split_row_estimate_data(split_row_data);
107 return m_active_cache->memory_used() +
108 (m_immutable_cache ? m_immutable_cache->memory_used() : 0);
112 return m_active_cache->logical_size() +
113 (m_immutable_cache ? m_immutable_cache->logical_size() : 0);
117 m_active_cache->add_statistics(stats);
118 if (m_immutable_cache)
119 m_immutable_cache->add_statistics(stats);
123 return m_active_cache->delete_count() +
124 (m_immutable_cache ? m_immutable_cache->delete_count() : 0);
128 m_immutable_cache = m_active_cache;
129 m_active_cache = make_shared<CellCache>();
133 if (m_immutable_cache)
134 m_immutable_cache->populate_key_set(keys);
135 m_active_cache->populate_key_set(keys);
int64_t logical_size()
Returns the logical amount of memory used by the active and immutable caches.
void populate_key_set(KeySet &keys)
Populates a set with all keys in the cell caches.
void add_immutable_scanner(MergeScannerAccessGroup *mscanner, ScanContext *scan_ctx)
Creates a scanner on the immutable cache and adds it to a merge scanner.
int64_t memory_used()
Returns the amount of memory used by the active and immutable caches.
int32_t delete_count()
Returns the number of deletes present in the caches.
Scan context information.
void split_row_estimate_data(CellList::SplitRowDataMapT &split_row_data)
Populates map of split row data.
A class managing one or more serializable ByteStrings.
std::set< Key, key_revision_lt > KeySet
void add_scanners(MergeScannerAccessGroup *scanner, ScanContext *scan_ctx)
Creates scanners on the active and immutable caches and adds them to a merge scanner.
std::map< const char *, int64_t, LtCstr, SplitRowDataAlloc > SplitRowDataMapT
Declarations for ScanContext.
Compatibility Macros for C/C++.
void add_scanner(CellListScannerPtr scanner)
Provides access to internal components of opaque key.
void get_cache_statistics(CellCache::Statistics &stats)
Gets cache statistics.
A serializable ByteString.
Declarations for CellCacheManager.
std::shared_ptr< Schema > SchemaPtr
Smart pointer to Schema.
std::shared_ptr< CellListScanner > CellListScannerPtr
void freeze()
Freezes the active cache.
void merge_caches(SchemaPtr &schema)
Merges immutable cache into active cache.
std::shared_ptr< CellCache > CellCachePtr
Shared smart pointer to CellCache.
std::shared_ptr< ScanContext > ScanContextPtr
void add(const Key &key, const ByteString value)
Inserts a key/value pair to the active cache.
Merge scanner for access groups.