Fix inconsistent code format

Summary:
Found some function follows camel style. When naming funciton, we have two styles:

Trivially expose internal data in readonly mode: `all_lower_case()`
Regular function: `CapitalizeFirstLetter()`

I renames these functions.

Test Plan: make -j32

Reviewers: haobo, sdong, dhruba, igor

CC: leveldb

Differential Revision: https://reviews.facebook.net/D16383
main
kailiu 11 years ago
parent a04dbf6e49
commit 444cafc28c
  1. 4
      table/block.h
  2. 20
      table/block_based_table_reader.cc

@ -26,8 +26,8 @@ class Block {
~Block(); ~Block();
size_t size() const { return size_; } size_t size() const { return size_; }
bool isCachable() const { return cachable_; } bool cachable() const { return cachable_; }
CompressionType compressionType() const { return compression_type_; } CompressionType compression_type() const { return compression_type_; }
Iterator* NewIterator(const Comparator* comparator); Iterator* NewIterator(const Comparator* comparator);
const char* data() { return data_; } const char* data() { return data_; }

@ -297,7 +297,7 @@ Status BlockBasedTable::Open(const Options& options, const EnvOptions& soptions,
); );
if (s.ok()) { if (s.ok()) {
assert(index_block->compressionType() == kNoCompression); assert(index_block->compression_type() == kNoCompression);
rep->index_block.reset(index_block); rep->index_block.reset(index_block);
// Set filter block // Set filter block
@ -461,7 +461,7 @@ Status BlockBasedTable::GetBlock(
); );
} }
if (s.ok()) { if (s.ok()) {
if (options.fill_cache && entry->value->isCachable()) { if (options.fill_cache && entry->value->cachable()) {
entry->cache_handle = block_cache->Insert( entry->cache_handle = block_cache->Insert(
key, entry->value, entry->value->size(), &DeleteCachedBlock); key, entry->value, entry->value->size(), &DeleteCachedBlock);
RecordTick(statistics, BLOCK_CACHE_ADD); RecordTick(statistics, BLOCK_CACHE_ADD);
@ -563,7 +563,7 @@ Iterator* BlockBasedTable::BlockReader(void* arg,
// found compressed block // found compressed block
cblock = reinterpret_cast<Block*>(block_cache_compressed-> cblock = reinterpret_cast<Block*>(block_cache_compressed->
Value(compressed_cache_handle)); Value(compressed_cache_handle));
assert(cblock->compressionType() != kNoCompression); assert(cblock->compression_type() != kNoCompression);
// Retrieve the uncompressed contents into a new buffer // Retrieve the uncompressed contents into a new buffer
BlockContents contents; BlockContents contents;
@ -573,8 +573,8 @@ Iterator* BlockBasedTable::BlockReader(void* arg,
// Insert uncompressed block into block cache // Insert uncompressed block into block cache
if (s.ok()) { if (s.ok()) {
block = new Block(contents); // uncompressed block block = new Block(contents); // uncompressed block
assert(block->compressionType() == kNoCompression); assert(block->compression_type() == kNoCompression);
if (block_cache != nullptr && block->isCachable() && if (block_cache != nullptr && block->cachable() &&
options.fill_cache) { options.fill_cache) {
cache_handle = block_cache->Insert(key, block, block->size(), cache_handle = block_cache->Insert(key, block, block->size(),
&DeleteCachedBlock); &DeleteCachedBlock);
@ -609,23 +609,23 @@ Iterator* BlockBasedTable::BlockReader(void* arg,
); );
} }
if (s.ok()) { if (s.ok()) {
assert(cblock->compressionType() == kNoCompression || assert(cblock->compression_type() == kNoCompression ||
block_cache_compressed != nullptr); block_cache_compressed != nullptr);
// Retrieve the uncompressed contents into a new buffer // Retrieve the uncompressed contents into a new buffer
BlockContents contents; BlockContents contents;
if (cblock->compressionType() != kNoCompression) { if (cblock->compression_type() != kNoCompression) {
s = UncompressBlockContents(cblock->data(), cblock->size(), s = UncompressBlockContents(cblock->data(), cblock->size(),
&contents); &contents);
} }
if (s.ok()) { if (s.ok()) {
if (cblock->compressionType() != kNoCompression) { if (cblock->compression_type() != kNoCompression) {
block = new Block(contents); // uncompressed block block = new Block(contents); // uncompressed block
} else { } else {
block = cblock; block = cblock;
cblock = nullptr; cblock = nullptr;
} }
if (block->isCachable() && options.fill_cache) { if (block->cachable() && options.fill_cache) {
// Insert compressed block into compressed block cache. // Insert compressed block into compressed block cache.
// Release the hold on the compressed cache entry immediately. // Release the hold on the compressed cache entry immediately.
if (block_cache_compressed != nullptr && cblock != nullptr) { if (block_cache_compressed != nullptr && cblock != nullptr) {
@ -636,7 +636,7 @@ Iterator* BlockBasedTable::BlockReader(void* arg,
cblock = nullptr; cblock = nullptr;
} }
// insert into uncompressed block cache // insert into uncompressed block cache
assert((block->compressionType() == kNoCompression)); assert((block->compression_type() == kNoCompression));
if (block_cache != nullptr) { if (block_cache != nullptr) {
cache_handle = block_cache->Insert( cache_handle = block_cache->Insert(
key, block, block->size(), &DeleteCachedBlock); key, block, block->size(), &DeleteCachedBlock);

Loading…
Cancel
Save