mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Pull from upstream.
git-svn-id: https://leveldb.googlecode.com/svn/trunk@14 62dab493-f737-651d-591e-8d6aee1b9529
This commit is contained in:
@@ -138,11 +138,14 @@ void TableBuilder::WriteBlock(BlockBuilder* block, BlockHandle* handle) {
|
||||
block_contents = raw;
|
||||
break;
|
||||
|
||||
case kLightweightCompression: {
|
||||
port::Lightweight_Compress(raw.data(), raw.size(), &r->compressed_output);
|
||||
block_contents = r->compressed_output;
|
||||
if (block_contents.size() >= raw.size() - (raw.size() / 8u)) {
|
||||
// Compressed less than 12.5%, so just store uncompressed form
|
||||
case kSnappyCompression: {
|
||||
std::string* compressed = &r->compressed_output;
|
||||
if (port::Snappy_Compress(raw.data(), raw.size(), compressed) &&
|
||||
compressed->size() < raw.size() - (raw.size() / 8u)) {
|
||||
block_contents = *compressed;
|
||||
} else {
|
||||
// Snappy not supported, or compressed less than 12.5%, so just
|
||||
// store uncompressed form
|
||||
block_contents = raw;
|
||||
type = kNoCompression;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user