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

Method LoadDataBlock

storage/sstable/reader/on_disk_sstable_reader.cpp:25–39  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

23}
24
25std::shared_ptr<hfile::DataBlock> OnDiskSSTableReader::LoadDataBlock(int block_id) {
26 std::shared_ptr<hfile::DataBlock> block;
27 if (!block_cache_->Get(block_id, &block)) {
28 // not in cache,
29 hfile::DataBlock *new_block = new hfile::DataBlock(impl_->file_trailer_->compress_type());
30 if (!impl_->LoadDataBlock(block_id, new_block)) {
31 delete new_block;
32 LOG(ERROR)<< "fail to load data block!";
33 return std::shared_ptr<hfile::DataBlock>();
34 }
35 block.reset(new_block);
36 block_cache_->Put(block_id, block);
37 }
38 return block;
39}
40
41SSTableReader::Iterator *OnDiskSSTableReader::Seek(const std::string &key) {
42 return new OnDiskIterator(this, key);

Callers 2

SeekKeyMethod · 0.45
NextItemMethod · 0.45

Calls 4

GetMethod · 0.45
compress_typeMethod · 0.45
resetMethod · 0.45
PutMethod · 0.45

Tested by

no test coverage detected