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

Method EncodeToString

storage/sstable/hfile/data_block.cpp:44–57  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

42}
43
44const std::string DataBlock::EncodeToString() const {
45 if (compression_ != NULL) {
46 std::string compressed;
47 if (!compression_->Compress(buffer_.c_str(), buffer_.size(), &compressed)) {
48 LOG(ERROR)<< "compress failed!";
49 return "";
50 }
51 // save the compressed info
52 compressed_size_ = compressed.size();
53 return compressed;
54 }
55 compressed_size_ = buffer_.size();
56 return buffer_;
57}
58
59bool DataBlock::DecodeFromString(const std::string &str) {
60 if (compression_ != NULL) {

Callers

nothing calls this directly

Calls 2

CompressMethod · 0.80
sizeMethod · 0.45

Tested by

no test coverage detected