MCPcopy Create free account
hub / github.com/chen3feng/toft / Init

Method Init

storage/sstable/reader/in_memory_sstable_reader.cpp:20–45  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

18}
19
20void InMemorySSTableReader::Init() {
21 cached_block_.reset(new hfile::DataBlock(impl_->file_trailer_->compress_type()));
22 std::vector<std::string> values;
23 std::string ori_key = "";
24 for (int block_id = 0; block_id < impl_->file_trailer_->data_index_count(); block_id++) {
25 impl_->LoadDataBlock(block_id, cached_block_.get());
26 for (int data_idx = 0; data_idx < cached_block_->GetDataItemSize(); data_idx++) {
27 if (block_id == 0 && data_idx == 0) {
28 ori_key = cached_block_->GetKey(0);
29 }
30 std::string key = cached_block_->GetKey(data_idx);
31 std::string value = cached_block_->GetValue(data_idx);
32 if (key != ori_key) {
33 data_.push_back(make_pair(ori_key, values));
34 ori_key = key;
35 values.clear();
36 }
37 values.push_back(value);
38 }
39 }
40 data_.push_back(make_pair(ori_key, values));
41// index_.resize(data_.size() * 2);
42 for (DataVector::iterator it = data_.begin(); it != data_.end(); it++) {
43 index_.insert(make_pair(it->first, it));
44 }
45}
46
47InMemoryIterator::InMemoryIterator(InMemorySSTableReader *sstable, const std::string &key)
48 : sstable_(sstable) {

Callers 1

OpenMethod · 0.45

Calls 12

data_index_countMethod · 0.80
GetDataItemSizeMethod · 0.80
GetKeyMethod · 0.80
push_backMethod · 0.80
resetMethod · 0.45
compress_typeMethod · 0.45
LoadDataBlockMethod · 0.45
getMethod · 0.45
GetValueMethod · 0.45
clearMethod · 0.45
beginMethod · 0.45
endMethod · 0.45

Tested by

no test coverage detected