Change namespace from leveldb to rocksdb

Summary:
Change namespace from leveldb to rocksdb. This allows a single
application to link in open-source leveldb code as well as
rocksdb code into the same process.

Test Plan: compile rocksdb

Reviewers: emayanke

Reviewed By: emayanke

CC: leveldb

Differential Revision: https://reviews.facebook.net/D13287
This commit is contained in:
Dhruba Borthakur
2013-10-03 21:49:15 -07:00
parent b3ed08129b
commit a143ef9b38
226 changed files with 871 additions and 815 deletions

View File

@@ -13,7 +13,7 @@
#include "util/coding.h"
#include "util/logging.h"
namespace leveldb {
namespace rocksdb {
inline uint32_t Block::NumRestarts() const {
assert(size_ >= 2*sizeof(uint32_t));
@@ -265,4 +265,4 @@ Iterator* Block::NewIterator(const Comparator* cmp) {
}
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -9,7 +9,7 @@
#include <stdint.h>
#include "rocksdb/iterator.h"
namespace leveldb {
namespace rocksdb {
struct BlockContents;
class Comparator;
@@ -41,6 +41,6 @@ class Block {
class Iter;
};
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_BLOCK_H_

View File

@@ -34,7 +34,7 @@
#include "rocksdb/table_builder.h"
#include "util/coding.h"
namespace leveldb {
namespace rocksdb {
BlockBuilder::BlockBuilder(const Options* options)
: options_(options),
@@ -121,4 +121,4 @@ void BlockBuilder::Add(const Slice& key, const Slice& value) {
counter_++;
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -10,7 +10,7 @@
#include <stdint.h>
#include "rocksdb/slice.h"
namespace leveldb {
namespace rocksdb {
struct Options;
@@ -55,6 +55,6 @@ class BlockBuilder {
void operator=(const BlockBuilder&);
};
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_BLOCK_BUILDER_H_

View File

@@ -17,7 +17,7 @@
#include "util/testharness.h"
#include "util/testutil.h"
namespace leveldb {
namespace rocksdb {
static std::string RandomString(Random* rnd, int len) {
std::string r;
@@ -97,8 +97,8 @@ TEST(BlockTest, SimpleTest) {
delete iter;
}
} // namespace leveldb
} // namespace rocksdb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
return rocksdb::test::RunAllTests();
}

View File

@@ -8,7 +8,7 @@
#include "rocksdb/filter_policy.h"
#include "util/coding.h"
namespace leveldb {
namespace rocksdb {
// See doc/table_format.txt for an explanation of the filter block format.

View File

@@ -18,7 +18,7 @@
#include "rocksdb/slice_transform.h"
#include "util/hash.h"
namespace leveldb {
namespace rocksdb {
class FilterPolicy;

View File

@@ -11,7 +11,7 @@
#include "util/testharness.h"
#include "util/testutil.h"
namespace leveldb {
namespace rocksdb {
// For testing: emit an array with one hash value per key
class TestHashFilter : public FilterPolicy {
@@ -127,8 +127,8 @@ TEST(FilterBlockTest, MultiChunk) {
ASSERT_TRUE(! reader.KeyMayMatch(9000, "bar"));
}
} // namespace leveldb
} // namespace rocksdb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
return rocksdb::test::RunAllTests();
}

View File

@@ -11,7 +11,7 @@
#include "util/crc32c.h"
#include "util/perf_context_imp.h"
namespace leveldb {
namespace rocksdb {
void BlockHandle::EncodeTo(std::string* dst) const {
// Sanity check that all fields have been set
@@ -187,4 +187,4 @@ Status ReadBlockContents(RandomAccessFile* file,
return Status::OK();
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -11,7 +11,7 @@
#include "rocksdb/status.h"
#include "rocksdb/table_builder.h"
namespace leveldb {
namespace rocksdb {
class Block;
class RandomAccessFile;
@@ -104,6 +104,6 @@ inline BlockHandle::BlockHandle()
size_(~static_cast<uint64_t>(0)) {
}
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_FORMAT_H_

View File

@@ -7,7 +7,7 @@
#include "rocksdb/comparator.h"
#include "table/iterator_wrapper.h"
namespace leveldb {
namespace rocksdb {
// Return the max of two keys.
class MaxIteratorComparator {
@@ -58,6 +58,6 @@ MinIterHeap NewMinIterHeap(const Comparator* comparator) {
return MinIterHeap(MinIteratorComparator(comparator));
}
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_ITER_HEAP_H_

View File

@@ -4,7 +4,7 @@
#include "rocksdb/iterator.h"
namespace leveldb {
namespace rocksdb {
Iterator::Iterator() {
cleanup_.function = nullptr;
@@ -64,4 +64,4 @@ Iterator* NewErrorIterator(const Status& status) {
return new EmptyIterator(status);
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_TABLE_ITERATOR_WRAPPER_H_
#define STORAGE_LEVELDB_TABLE_ITERATOR_WRAPPER_H_
namespace leveldb {
namespace rocksdb {
// A internal wrapper class with an interface similar to Iterator that
// caches the valid() and key() results for an underlying iterator.
@@ -58,6 +58,6 @@ class IteratorWrapper {
Slice key_;
};
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_ITERATOR_WRAPPER_H_

View File

@@ -11,7 +11,7 @@
#include <vector>
namespace leveldb {
namespace rocksdb {
namespace {
@@ -220,4 +220,4 @@ Iterator* NewMergingIterator(const Comparator* cmp, Iterator** list, int n) {
}
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -5,7 +5,7 @@
#ifndef STORAGE_LEVELDB_TABLE_MERGER_H_
#define STORAGE_LEVELDB_TABLE_MERGER_H_
namespace leveldb {
namespace rocksdb {
class Comparator;
class Iterator;
@@ -21,6 +21,6 @@ class Iterator;
extern Iterator* NewMergingIterator(
const Comparator* comparator, Iterator** children, int n);
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_MERGER_H_

View File

@@ -22,7 +22,7 @@
#include "util/perf_context_imp.h"
#include "util/stop_watch.h"
namespace leveldb {
namespace rocksdb {
// The longest the prefix of the cache key used to identify blocks can be.
// We are using the fact that we know for Posix files the unique ID is three
@@ -495,4 +495,4 @@ uint64_t Table::ApproximateOffsetOf(const Slice& key) const {
return result;
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -10,7 +10,7 @@
#include "rocksdb/iterator.h"
#include "rocksdb/env.h"
namespace leveldb {
namespace rocksdb {
class Block;
class BlockHandle;
@@ -102,6 +102,6 @@ class Table {
void operator=(const Table&);
};
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_INCLUDE_TABLE_H_

View File

@@ -16,7 +16,7 @@
#include "util/crc32c.h"
#include "util/stop_watch.h"
namespace leveldb {
namespace rocksdb {
struct TableBuilder::Rep {
Options options;
@@ -324,4 +324,4 @@ uint64_t TableBuilder::FileSize() const {
return rep_->offset;
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -20,7 +20,7 @@
#include "util/testharness.h"
#include "util/testutil.h"
namespace leveldb {
namespace rocksdb {
// Return reverse of "key".
// Used to test non-lexicographic comparators.
@@ -961,8 +961,8 @@ TEST(TableTest, BlockCacheLeak) {
}
}
} // namespace leveldb
} // namespace rocksdb
int main(int argc, char** argv) {
return leveldb::test::RunAllTests();
return rocksdb::test::RunAllTests();
}

View File

@@ -9,7 +9,7 @@
#include "table/table.h"
#include "table/iterator_wrapper.h"
namespace leveldb {
namespace rocksdb {
namespace {
@@ -194,4 +194,4 @@ Iterator* NewTwoLevelIterator(
options, soptions, for_compaction);
}
} // namespace leveldb
} // namespace rocksdb

View File

@@ -8,7 +8,7 @@
#include "rocksdb/iterator.h"
#include "rocksdb/env.h"
namespace leveldb {
namespace rocksdb {
struct ReadOptions;
@@ -34,6 +34,6 @@ extern Iterator* NewTwoLevelIterator(
const EnvOptions& soptions,
bool for_compaction = false);
} // namespace leveldb
} // namespace rocksdb
#endif // STORAGE_LEVELDB_TABLE_TWO_LEVEL_ITERATOR_H_