diff --git a/db/builder.cc b/db/builder.cc index 3d97f4656..5097f0bb4 100644 --- a/db/builder.cc +++ b/db/builder.cc @@ -14,7 +14,7 @@ #include "rocksdb/iterator.h" #include "util/stop_watch.h" -namespace leveldb { +namespace rocksdb { Status BuildTable(const std::string& dbname, Env* env, @@ -204,4 +204,4 @@ Status BuildTable(const std::string& dbname, return s; } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/builder.h b/db/builder.h index 8de5d4335..bce91e568 100644 --- a/db/builder.h +++ b/db/builder.h @@ -9,7 +9,7 @@ #include "rocksdb/status.h" #include "rocksdb/types.h" -namespace leveldb { +namespace rocksdb { struct Options; struct FileMetaData; @@ -36,6 +36,6 @@ extern Status BuildTable(const std::string& dbname, const SequenceNumber newest_snapshot, const SequenceNumber earliest_seqno_in_memtable); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_BUILDER_H_ diff --git a/db/c.cc b/db/c.cc index ff4d4fbb1..50f52eb22 100644 --- a/db/c.cc +++ b/db/c.cc @@ -16,28 +16,28 @@ #include "rocksdb/status.h" #include "rocksdb/write_batch.h" -using leveldb::Cache; -using leveldb::Comparator; -using leveldb::CompressionType; -using leveldb::DB; -using leveldb::Env; -using leveldb::FileLock; -using leveldb::FilterPolicy; -using leveldb::Iterator; -using leveldb::Logger; -using leveldb::NewBloomFilterPolicy; -using leveldb::NewLRUCache; -using leveldb::Options; -using leveldb::RandomAccessFile; -using leveldb::Range; -using leveldb::ReadOptions; -using leveldb::SequentialFile; -using leveldb::Slice; -using leveldb::Snapshot; -using leveldb::Status; -using leveldb::WritableFile; -using leveldb::WriteBatch; -using leveldb::WriteOptions; +using rocksdb::Cache; +using rocksdb::Comparator; +using rocksdb::CompressionType; +using rocksdb::DB; +using rocksdb::Env; +using rocksdb::FileLock; +using rocksdb::FilterPolicy; +using rocksdb::Iterator; +using rocksdb::Logger; +using rocksdb::NewBloomFilterPolicy; +using rocksdb::NewLRUCache; +using rocksdb::Options; +using rocksdb::RandomAccessFile; +using rocksdb::Range; +using rocksdb::ReadOptions; +using rocksdb::SequentialFile; +using rocksdb::Slice; +using rocksdb::Snapshot; +using rocksdb::Status; +using rocksdb::WritableFile; +using rocksdb::WriteBatch; +using rocksdb::WriteOptions; using std::shared_ptr; diff --git a/db/corruption_test.cc b/db/corruption_test.cc index 5bc65b900..c8c7b048e 100644 --- a/db/corruption_test.cc +++ b/db/corruption_test.cc @@ -20,7 +20,7 @@ #include "util/testharness.h" #include "util/testutil.h" -namespace leveldb { +namespace rocksdb { static const int kValueSize = 1000; @@ -68,7 +68,7 @@ class CorruptionTest { void RepairDB() { delete db_; db_ = nullptr; - ASSERT_OK(::leveldb::RepairDB(dbname_, options_)); + ASSERT_OK(::rocksdb::RepairDB(dbname_, options_)); } void Build(int n) { @@ -354,8 +354,8 @@ TEST(CorruptionTest, UnrelatedKeys) { ASSERT_EQ(Value(1000, &tmp2).ToString(), v); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/db_bench.cc b/db/db_bench.cc index 1bc1caa73..cacec5aeb 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -153,7 +153,7 @@ static int FLAGS_min_write_buffer_number_to_merge = 0; static int FLAGS_max_background_compactions = 0; // style of compaction: level-based vs universal -static leveldb::CompactionStyle FLAGS_compaction_style = leveldb::kCompactionStyleLevel; +static rocksdb::CompactionStyle FLAGS_compaction_style = rocksdb::kCompactionStyleLevel; // Percentage flexibility while comparing file size // (for universal compaction only). @@ -201,7 +201,7 @@ static bool FLAGS_verify_checksum = false; // Database statistics static bool FLAGS_statistics = false; -static class std::shared_ptr dbstats; +static class std::shared_ptr dbstats; // Number of write operations to do. If negative, do FLAGS_num reads. static long FLAGS_writes = -1; @@ -279,8 +279,8 @@ static int FLAGS_disable_seek_compaction = false; static uint64_t FLAGS_delete_obsolete_files_period_micros = 0; // Algorithm used to compress the database -static enum leveldb::CompressionType FLAGS_compression_type = - leveldb::kSnappyCompression; +static enum rocksdb::CompressionType FLAGS_compression_type = + rocksdb::kSnappyCompression; // If non-negative, compression starts from this level. Levels with number // < FLAGS_min_level_to_compress are not compressed. @@ -290,7 +290,7 @@ static int FLAGS_min_level_to_compress = -1; static int FLAGS_table_cache_numshardbits = 4; // posix or hdfs environment -static leveldb::Env* FLAGS_env = leveldb::Env::Default(); +static rocksdb::Env* FLAGS_env = rocksdb::Env::Default(); // Stats are reported every N operations when this is greater // than zero. When 0 the interval grows over time. @@ -339,11 +339,11 @@ static bool FLAGS_use_mmap_writes; // Advise random access on table file open static bool FLAGS_advise_random_on_open = - leveldb::Options().advise_random_on_open; + rocksdb::Options().advise_random_on_open; // Access pattern advice when a file is compacted static auto FLAGS_compaction_fadvice = - leveldb::Options().access_hint_on_compaction_start; + rocksdb::Options().access_hint_on_compaction_start; // Use multiget to access a series of keys instead of get static bool FLAGS_use_multiget = false; @@ -358,13 +358,13 @@ static bool FLAGS_warn_missing_keys = true; // Use adaptive mutex static auto FLAGS_use_adaptive_mutex = - leveldb::Options().use_adaptive_mutex; + rocksdb::Options().use_adaptive_mutex; // Allows OS to incrementally sync files to disk while they are being // written, in the background. Issue one request for every bytes_per_sync // written. 0 turns it off. static auto FLAGS_bytes_per_sync = - leveldb::Options().bytes_per_sync; + rocksdb::Options().bytes_per_sync; // On true, deletes use bloom-filter and drop the delete if key not present static bool FLAGS_filter_deletes = false; @@ -387,9 +387,9 @@ static enum RepFactory FLAGS_rep_factory; static std::string FLAGS_merge_operator = ""; static auto FLAGS_purge_log_after_memtable_flush = - leveldb::Options().purge_log_after_memtable_flush; + rocksdb::Options().purge_log_after_memtable_flush; -namespace leveldb { +namespace rocksdb { // Helper for quickly generating random data. class RandomGenerator { @@ -691,16 +691,16 @@ class Benchmark { fprintf(stdout, "Write rate limit: %d\n", FLAGS_writes_per_second); switch (FLAGS_compression_type) { - case leveldb::kNoCompression: + case rocksdb::kNoCompression: fprintf(stdout, "Compression: none\n"); break; - case leveldb::kSnappyCompression: + case rocksdb::kSnappyCompression: fprintf(stdout, "Compression: snappy\n"); break; - case leveldb::kZlibCompression: + case rocksdb::kZlibCompression: fprintf(stdout, "Compression: zlib\n"); break; - case leveldb::kBZip2Compression: + case rocksdb::kBZip2Compression: fprintf(stdout, "Compression: bzip2\n"); break; } @@ -735,7 +735,7 @@ class Benchmark { "WARNING: Assertions are enabled; benchmarks unnecessarily slow\n"); #endif - if (FLAGS_compression_type != leveldb::kNoCompression) { + if (FLAGS_compression_type != rocksdb::kNoCompression) { // The test string should not be too small. const int len = FLAGS_block_size; char* text = (char*) malloc(len+1); @@ -2303,24 +2303,24 @@ class Benchmark { } }; -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - leveldb::InstallStackTraceHandler(); + rocksdb::InstallStackTraceHandler(); - FLAGS_write_buffer_size = leveldb::Options().write_buffer_size; - FLAGS_max_write_buffer_number = leveldb::Options().max_write_buffer_number; + FLAGS_write_buffer_size = rocksdb::Options().write_buffer_size; + FLAGS_max_write_buffer_number = rocksdb::Options().max_write_buffer_number; FLAGS_min_write_buffer_number_to_merge = - leveldb::Options().min_write_buffer_number_to_merge; - FLAGS_open_files = leveldb::Options().max_open_files; + rocksdb::Options().min_write_buffer_number_to_merge; + FLAGS_open_files = rocksdb::Options().max_open_files; FLAGS_max_background_compactions = - leveldb::Options().max_background_compactions; - FLAGS_compaction_style = leveldb::Options().compaction_style; + rocksdb::Options().max_background_compactions; + FLAGS_compaction_style = rocksdb::Options().compaction_style; // Compression test code above refers to FLAGS_block_size - FLAGS_block_size = leveldb::Options().block_size; - FLAGS_use_os_buffer = leveldb::EnvOptions().use_os_buffer; - FLAGS_use_mmap_reads = leveldb::EnvOptions().use_mmap_reads; - FLAGS_use_mmap_writes = leveldb::EnvOptions().use_mmap_writes; + FLAGS_block_size = rocksdb::Options().block_size; + FLAGS_use_os_buffer = rocksdb::EnvOptions().use_os_buffer; + FLAGS_use_mmap_reads = rocksdb::EnvOptions().use_mmap_reads; + FLAGS_use_mmap_writes = rocksdb::EnvOptions().use_mmap_writes; std::string default_db_path; @@ -2333,7 +2333,7 @@ int main(int argc, char** argv) { char buf[2048]; char str[512]; - if (leveldb::Slice(argv[i]).starts_with("--benchmarks=")) { + if (rocksdb::Slice(argv[i]).starts_with("--benchmarks=")) { FLAGS_benchmarks = argv[i] + strlen("--benchmarks="); } else if (sscanf(argv[i], "--compression_ratio=%lf%c", &d, &junk) == 1) { FLAGS_compression_ratio = d; @@ -2384,7 +2384,7 @@ int main(int argc, char** argv) { == 1) { FLAGS_max_background_compactions = n; } else if (sscanf(argv[i], "--compaction_style=%d%c", &n, &junk) == 1) { - FLAGS_compaction_style = (leveldb::CompactionStyle)n; + FLAGS_compaction_style = (rocksdb::CompactionStyle)n; } else if (sscanf(argv[i], "--cache_size=%ld%c", &l, &junk) == 1) { FLAGS_cache_size = l; } else if (sscanf(argv[i], "--block_size=%d%c", &n, &junk) == 1) { @@ -2424,7 +2424,7 @@ int main(int argc, char** argv) { } else if (sscanf(argv[i], "--statistics=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) { if (n == 1) { - dbstats = leveldb::CreateDBStatistics(); + dbstats = rocksdb::CreateDBStatistics(); FLAGS_statistics = true; } } else if (sscanf(argv[i], "--writes=%lld%c", &ll, &junk) == 1) { @@ -2456,7 +2456,7 @@ int main(int argc, char** argv) { (n == 0 || n == 1)) { FLAGS_get_approx = n; } else if (sscanf(argv[i], "--hdfs=%s", buf) == 1) { - FLAGS_env = new leveldb::HdfsEnv(buf); + FLAGS_env = new rocksdb::HdfsEnv(buf); } else if (sscanf(argv[i], "--num_levels=%d%c", &n, &junk) == 1) { FLAGS_num_levels = n; @@ -2478,7 +2478,7 @@ int main(int argc, char** argv) { } else if (sscanf(argv[i], "--max_bytes_for_level_multiplier_additional=%s%c", str, &junk) == 1) { - std::vector fanout = leveldb::stringSplit(str, ','); + std::vector fanout = rocksdb::stringSplit(str, ','); for (unsigned int j= 0; j < fanout.size(); j++) { FLAGS_max_bytes_for_level_multiplier_additional.push_back( std::stoi(fanout[j])); @@ -2492,13 +2492,13 @@ int main(int argc, char** argv) { } else if (strncmp(argv[i], "--compression_type=", 19) == 0) { const char* ctype = argv[i] + 19; if (!strcasecmp(ctype, "none")) - FLAGS_compression_type = leveldb::kNoCompression; + FLAGS_compression_type = rocksdb::kNoCompression; else if (!strcasecmp(ctype, "snappy")) - FLAGS_compression_type = leveldb::kSnappyCompression; + FLAGS_compression_type = rocksdb::kSnappyCompression; else if (!strcasecmp(ctype, "zlib")) - FLAGS_compression_type = leveldb::kZlibCompression; + FLAGS_compression_type = rocksdb::kZlibCompression; else if (!strcasecmp(ctype, "bzip2")) - FLAGS_compression_type = leveldb::kBZip2Compression; + FLAGS_compression_type = rocksdb::kBZip2Compression; else { fprintf(stdout, "Cannot parse %s\n", argv[i]); } @@ -2561,13 +2561,13 @@ int main(int argc, char** argv) { FLAGS_advise_random_on_open = n; } else if (sscanf(argv[i], "--compaction_fadvice=%s", buf) == 1) { if (!strcasecmp(buf, "NONE")) - FLAGS_compaction_fadvice = leveldb::Options::NONE; + FLAGS_compaction_fadvice = rocksdb::Options::NONE; else if (!strcasecmp(buf, "NORMAL")) - FLAGS_compaction_fadvice = leveldb::Options::NORMAL; + FLAGS_compaction_fadvice = rocksdb::Options::NORMAL; else if (!strcasecmp(buf, "SEQUENTIAL")) - FLAGS_compaction_fadvice = leveldb::Options::SEQUENTIAL; + FLAGS_compaction_fadvice = rocksdb::Options::SEQUENTIAL; else if (!strcasecmp(buf, "WILLNEED")) - FLAGS_compaction_fadvice = leveldb::Options::WILLNEED; + FLAGS_compaction_fadvice = rocksdb::Options::WILLNEED; else { fprintf(stdout, "Unknown compaction fadvice:%s\n", buf); } @@ -2615,12 +2615,12 @@ int main(int argc, char** argv) { // Choose a location for the test database if none given with --db= if (FLAGS_db == nullptr) { - leveldb::Env::Default()->GetTestDirectory(&default_db_path); + rocksdb::Env::Default()->GetTestDirectory(&default_db_path); default_db_path += "/dbbench"; FLAGS_db = default_db_path.c_str(); } - leveldb::Benchmark benchmark; + rocksdb::Benchmark benchmark; benchmark.Run(); return 0; } diff --git a/db/db_filesnapshot.cc b/db/db_filesnapshot.cc index e517c17c7..9291e6aaf 100644 --- a/db/db_filesnapshot.cc +++ b/db/db_filesnapshot.cc @@ -13,7 +13,7 @@ #include "port/port.h" #include "util/mutexlock.h" -namespace leveldb { +namespace rocksdb { Status DBImpl::DisableFileDeletions() { MutexLock l(&mutex_); diff --git a/db/db_impl.cc b/db/db_impl.cc index 9a451f5d7..d31936778 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -47,7 +47,7 @@ #include "util/mutexlock.h" #include "util/stop_watch.h" -namespace leveldb { +namespace rocksdb { void dumpLeveldbBuildVersion(Logger * log); @@ -3294,4 +3294,4 @@ void dumpLeveldbBuildVersion(Logger * log) { leveldb_build_compile_time, leveldb_build_compile_date); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/db_impl.h b/db/db_impl.h index 2ffaf6a40..7b7c8d3d5 100644 --- a/db/db_impl.h +++ b/db/db_impl.h @@ -24,7 +24,7 @@ #include "scribe/scribe_logger.h" #endif -namespace leveldb { +namespace rocksdb { class MemTable; class TableCache; @@ -444,6 +444,6 @@ extern Options SanitizeOptions(const std::string& db, const InternalFilterPolicy* ipolicy, const Options& src); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_DB_IMPL_H_ diff --git a/db/db_impl_readonly.cc b/db/db_impl_readonly.cc index c4fa1fe26..a42e98b1c 100644 --- a/db/db_impl_readonly.cc +++ b/db/db_impl_readonly.cc @@ -34,7 +34,7 @@ #include "util/logging.h" #include "util/build_version.h" -namespace leveldb { +namespace rocksdb { DBImplReadOnly::DBImplReadOnly(const Options& options, const std::string& dbname) diff --git a/db/db_impl_readonly.h b/db/db_impl_readonly.h index d65876988..de26ba2e1 100644 --- a/db/db_impl_readonly.h +++ b/db/db_impl_readonly.h @@ -21,7 +21,7 @@ #include "scribe/scribe_logger.h" #endif -namespace leveldb { +namespace rocksdb { class DBImplReadOnly : public DBImpl { public: diff --git a/db/db_iter.cc b/db/db_iter.cc index d68dcdda9..8b1637b7d 100644 --- a/db/db_iter.cc +++ b/db/db_iter.cc @@ -17,7 +17,7 @@ #include "util/mutexlock.h" #include "util/perf_context_imp.h" -namespace leveldb { +namespace rocksdb { #if 0 static void DumpInternalIter(Iterator* iter) { @@ -471,4 +471,4 @@ Iterator* NewDBIterator( internal_iter, sequence); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/db_iter.h b/db/db_iter.h index b29dfa5c9..7293e0651 100644 --- a/db/db_iter.h +++ b/db/db_iter.h @@ -9,7 +9,7 @@ #include "rocksdb/db.h" #include "db/dbformat.h" -namespace leveldb { +namespace rocksdb { // Return a new iterator that converts internal keys (yielded by // "*internal_iter") that were live at the specified "sequence" number @@ -22,6 +22,6 @@ extern Iterator* NewDBIterator( Iterator* internal_iter, const SequenceNumber& sequence); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_DB_ITER_H_ diff --git a/db/db_statistics.h b/db/db_statistics.h index e141150be..561d47e8b 100644 --- a/db/db_statistics.h +++ b/db/db_statistics.h @@ -16,7 +16,7 @@ #include "util/mutexlock.h" -namespace leveldb { +namespace rocksdb { class DBStatistics: public Statistics { public: @@ -59,6 +59,6 @@ std::shared_ptr CreateDBStatistics() { return std::make_shared(); } -} // namespace leveldb +} // namespace rocksdb #endif // LEVELDB_STORAGE_DB_DB_STATISTICS_H_ diff --git a/db/db_stats_logger.cc b/db/db_stats_logger.cc index 2998df16d..1031251ed 100644 --- a/db/db_stats_logger.cc +++ b/db/db_stats_logger.cc @@ -12,7 +12,7 @@ #include "port/port.h" #include "util/mutexlock.h" -namespace leveldb { +namespace rocksdb { void DBImpl::MaybeScheduleLogDBDeployStats() { diff --git a/db/db_test.cc b/db/db_test.cc index 8c0dea31a..1e83ab799 100644 --- a/db/db_test.cc +++ b/db/db_test.cc @@ -23,7 +23,7 @@ #include "util/testutil.h" #include "utilities/merge_operators.h" -namespace leveldb { +namespace rocksdb { static bool SnappyCompressionSupported(const CompressionOptions& options) { std::string out; @@ -831,7 +831,7 @@ TEST(DBTest, KeyMayExist) { std::string value; Options options = CurrentOptions(); options.filter_policy = NewBloomFilterPolicy(20); - options.statistics = leveldb::CreateDBStatistics(); + options.statistics = rocksdb::CreateDBStatistics(); Reopen(&options); ASSERT_TRUE(!db_->KeyMayExist(ropts, "a", &value)); @@ -892,7 +892,7 @@ TEST(DBTest, NonBlockingIteration) { do { ReadOptions non_blocking_opts, regular_opts; Options options = CurrentOptions(); - options.statistics = leveldb::CreateDBStatistics(); + options.statistics = rocksdb::CreateDBStatistics(); non_blocking_opts.read_tier = kBlockCacheTier; Reopen(&options); @@ -1140,7 +1140,7 @@ TEST(DBTest, IterReseek) { Options options = CurrentOptions(); options.max_sequential_skip_in_iterations = 3; options.create_if_missing = true; - options.statistics = leveldb::CreateDBStatistics(); + options.statistics = rocksdb::CreateDBStatistics(); DestroyAndReopen(&options); // insert two keys with same userkey and verify that @@ -3858,7 +3858,7 @@ class ModelDB: public DB { return -1; } - virtual Status Flush(const leveldb::FlushOptions& options) { + virtual Status Flush(const rocksdb::FlushOptions& options) { Status ret; return ret; } @@ -3885,8 +3885,8 @@ class ModelDB: public DB { virtual SequenceNumber GetLatestSequenceNumber() { return 0; } - virtual Status GetUpdatesSince(leveldb::SequenceNumber, - unique_ptr*) { + virtual Status GetUpdatesSince(rocksdb::SequenceNumber, + unique_ptr*) { return Status::NotSupported("Not supported in Model DB"); } @@ -4303,16 +4303,16 @@ void BM_LogAndApply(int iters, int num_base_files) { buf, iters, us, ((float)us) / iters); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { if (argc > 1 && std::string(argv[1]) == "--benchmark") { - leveldb::BM_LogAndApply(1000, 1); - leveldb::BM_LogAndApply(1000, 100); - leveldb::BM_LogAndApply(1000, 10000); - leveldb::BM_LogAndApply(100, 100000); + rocksdb::BM_LogAndApply(1000, 1); + rocksdb::BM_LogAndApply(1000, 100); + rocksdb::BM_LogAndApply(1000, 10000); + rocksdb::BM_LogAndApply(100, 100000); return 0; } - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/dbformat.cc b/db/dbformat.cc index c1caa955f..8a0650467 100644 --- a/db/dbformat.cc +++ b/db/dbformat.cc @@ -8,7 +8,7 @@ #include "util/coding.h" #include "util/perf_context_imp.h" -namespace leveldb { +namespace rocksdb { static uint64_t PackSequenceAndType(uint64_t seq, ValueType t) { assert(seq <= kMaxSequenceNumber); @@ -139,4 +139,4 @@ LookupKey::LookupKey(const Slice& user_key, SequenceNumber s) { end_ = dst; } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/dbformat.h b/db/dbformat.h index 56a2580f4..ccc4fc5ae 100644 --- a/db/dbformat.h +++ b/db/dbformat.h @@ -15,7 +15,7 @@ #include "util/coding.h" #include "util/logging.h" -namespace leveldb { +namespace rocksdb { class InternalKey; @@ -223,6 +223,6 @@ inline LookupKey::~LookupKey() { if (start_ != space_) delete[] start_; } -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_FORMAT_H_ diff --git a/db/dbformat_test.cc b/db/dbformat_test.cc index 830945447..faffb0696 100644 --- a/db/dbformat_test.cc +++ b/db/dbformat_test.cc @@ -6,7 +6,7 @@ #include "util/logging.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { static std::string IKey(const std::string& user_key, uint64_t seq, @@ -105,8 +105,8 @@ TEST(FormatTest, InternalKeyShortestSuccessor) { ShortSuccessor(IKey("\xff\xff", 100, kTypeValue))); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/deletefile_test.cc b/db/deletefile_test.cc index 158baf065..3c4c459b4 100644 --- a/db/deletefile_test.cc +++ b/db/deletefile_test.cc @@ -16,7 +16,7 @@ #include #include -namespace leveldb { +namespace rocksdb { class DeleteFileTest { public: @@ -180,9 +180,9 @@ TEST(DeleteFileTest, DeleteFileWithIterator) { delete it; CloseDB(); } -} //namespace leveldb +} //namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/filename.cc b/db/filename.cc index 5b107d9ab..170b25069 100644 --- a/db/filename.cc +++ b/db/filename.cc @@ -10,7 +10,7 @@ #include "rocksdb/env.h" #include "util/logging.h" -namespace leveldb { +namespace rocksdb { // Given a path, flatten the path name by replacing all chars not in // {[0-9,a-z,A-Z,-,_,.]} with _. And append '\0' at the end. @@ -218,4 +218,4 @@ Status SetCurrentFile(Env* env, const std::string& dbname, return s; } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/filename.h b/db/filename.h index a9b305e38..fcfc372f5 100644 --- a/db/filename.h +++ b/db/filename.h @@ -13,7 +13,7 @@ #include "rocksdb/status.h" #include "port/port.h" -namespace leveldb { +namespace rocksdb { class Env; @@ -92,6 +92,6 @@ extern Status SetCurrentFile(Env* env, const std::string& dbname, uint64_t descriptor_number); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_FILENAME_H_ diff --git a/db/filename_test.cc b/db/filename_test.cc index a1b2aa5e6..2c246d395 100644 --- a/db/filename_test.cc +++ b/db/filename_test.cc @@ -9,7 +9,7 @@ #include "util/logging.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { class FileNameTest { }; @@ -128,8 +128,8 @@ TEST(FileNameTest, Construction) { ASSERT_EQ(kMetaDatabase, type); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/log_format.h b/db/log_format.h index 17d60bda9..dbf94bc94 100644 --- a/db/log_format.h +++ b/db/log_format.h @@ -8,7 +8,7 @@ #ifndef STORAGE_LEVELDB_DB_LOG_FORMAT_H_ #define STORAGE_LEVELDB_DB_LOG_FORMAT_H_ -namespace leveldb { +namespace rocksdb { namespace log { enum RecordType { @@ -30,6 +30,6 @@ static const unsigned int kBlockSize = 32768; static const int kHeaderSize = 4 + 1 + 2; } // namespace log -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_LOG_FORMAT_H_ diff --git a/db/log_reader.cc b/db/log_reader.cc index 3ff62a729..9ae59e646 100644 --- a/db/log_reader.cc +++ b/db/log_reader.cc @@ -9,7 +9,7 @@ #include "util/coding.h" #include "util/crc32c.h" -namespace leveldb { +namespace rocksdb { namespace log { Reader::Reporter::~Reporter() { @@ -256,4 +256,4 @@ unsigned int Reader::ReadPhysicalRecord(Slice* result) { } } // namespace log -} // namespace leveldb +} // namespace rocksdb diff --git a/db/log_reader.h b/db/log_reader.h index 19acc8480..89deccfaa 100644 --- a/db/log_reader.h +++ b/db/log_reader.h @@ -12,7 +12,7 @@ #include "rocksdb/slice.h" #include "rocksdb/status.h" -namespace leveldb { +namespace rocksdb { class SequentialFile; using std::unique_ptr; @@ -118,6 +118,6 @@ class Reader { }; } // namespace log -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_LOG_READER_H_ diff --git a/db/log_test.cc b/db/log_test.cc index f808447c8..2a16db018 100644 --- a/db/log_test.cc +++ b/db/log_test.cc @@ -10,7 +10,7 @@ #include "util/random.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { namespace log { // Construct a string of the specified length made out of the supplied @@ -516,8 +516,8 @@ TEST(LogTest, ReadPastEnd) { } } // namespace log -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/log_writer.cc b/db/log_writer.cc index c5bc73e5e..61c082072 100644 --- a/db/log_writer.cc +++ b/db/log_writer.cc @@ -9,7 +9,7 @@ #include "util/coding.h" #include "util/crc32c.h" -namespace leveldb { +namespace rocksdb { namespace log { Writer::Writer(unique_ptr&& dest) @@ -100,4 +100,4 @@ Status Writer::EmitPhysicalRecord(RecordType t, const char* ptr, size_t n) { } } // namespace log -} // namespace leveldb +} // namespace rocksdb diff --git a/db/log_writer.h b/db/log_writer.h index edcabd0a4..636eca8f2 100644 --- a/db/log_writer.h +++ b/db/log_writer.h @@ -11,7 +11,7 @@ #include "rocksdb/slice.h" #include "rocksdb/status.h" -namespace leveldb { +namespace rocksdb { class WritableFile; @@ -49,6 +49,6 @@ class Writer { }; } // namespace log -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_LOG_WRITER_H_ diff --git a/db/memtable.cc b/db/memtable.cc index 255169da2..7a0155a6c 100644 --- a/db/memtable.cc +++ b/db/memtable.cc @@ -14,7 +14,7 @@ #include "util/coding.h" #include "util/murmurhash.h" -namespace leveldb { +namespace rocksdb { MemTable::MemTable(const InternalKeyComparator& cmp, std::shared_ptr table_factory, @@ -238,4 +238,4 @@ bool MemTable::Get(const LookupKey& key, std::string* value, Status* s, return false; } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/memtable.h b/db/memtable.h index 9b3755cd0..5315a416a 100644 --- a/db/memtable.h +++ b/db/memtable.h @@ -15,7 +15,7 @@ #include "rocksdb/memtablerep.h" #include "util/arena_impl.h" -namespace leveldb { +namespace rocksdb { class Mutex; class MemTableIterator; @@ -146,6 +146,6 @@ class MemTable { void operator=(const MemTable&); }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_MEMTABLE_H_ diff --git a/db/memtablelist.cc b/db/memtablelist.cc index fa10a740e..6025bef74 100644 --- a/db/memtablelist.cc +++ b/db/memtablelist.cc @@ -10,7 +10,7 @@ #include "rocksdb/iterator.h" #include "util/coding.h" -namespace leveldb { +namespace rocksdb { class InternalKeyComparator; class Mutex; @@ -210,4 +210,4 @@ void MemTableList::GetMemTables(std::vector* output) { } } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/memtablelist.h b/db/memtablelist.h index 327a2e0f7..628e39d6d 100644 --- a/db/memtablelist.h +++ b/db/memtablelist.h @@ -11,7 +11,7 @@ #include "db/skiplist.h" #include "memtable.h" -namespace leveldb { +namespace rocksdb { class InternalKeyComparator; class Mutex; @@ -99,6 +99,6 @@ class MemTableList { }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_MEMTABLELIST_H_ diff --git a/db/merge_helper.cc b/db/merge_helper.cc index 6e1f364e8..b54fc0e5f 100644 --- a/db/merge_helper.cc +++ b/db/merge_helper.cc @@ -6,7 +6,7 @@ #include #include -namespace leveldb { +namespace rocksdb { // PRE: iter points to the first merge type entry // POST: iter points to the first entry beyond the merge process (or the end) @@ -189,4 +189,4 @@ void MergeHelper::MergeUntil(Iterator* iter, SequenceNumber stop_before, } } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/merge_helper.h b/db/merge_helper.h index b058f9869..ac9953d49 100644 --- a/db/merge_helper.h +++ b/db/merge_helper.h @@ -7,7 +7,7 @@ #include #include -namespace leveldb { +namespace rocksdb { class Comparator; class Iterator; @@ -93,6 +93,6 @@ class MergeHelper { bool success_; }; -} // namespace leveldb +} // namespace rocksdb #endif diff --git a/db/merge_operator.cc b/db/merge_operator.cc index 09ac26642..190dfee0c 100644 --- a/db/merge_operator.cc +++ b/db/merge_operator.cc @@ -7,7 +7,7 @@ #include "rocksdb/merge_operator.h" -namespace leveldb { +namespace rocksdb { // Given a "real" merge from the library, call the user's // associative merge function one-by-one on each of the operands. @@ -48,4 +48,4 @@ bool AssociativeMergeOperator::PartialMerge( return Merge(key, &left_operand, right_operand, new_value, logger); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/merge_test.cc b/db/merge_test.cc index 16d213d60..8cb00a01f 100644 --- a/db/merge_test.cc +++ b/db/merge_test.cc @@ -14,7 +14,7 @@ #include "utilities/utility_db.h" using namespace std; -using namespace leveldb; +using namespace rocksdb; std::shared_ptr OpenDb(const string& dbname, const bool ttl = false) { diff --git a/db/perf_context_test.cc b/db/perf_context_test.cc index 2eafdbece..2a9a1f485 100644 --- a/db/perf_context_test.cc +++ b/db/perf_context_test.cc @@ -18,9 +18,9 @@ int FLAGS_max_write_buffer_number = 8; int FLAGS_min_write_buffer_number_to_merge = 7; // Path to the database on file system -const std::string kDbName = leveldb::test::TmpDir() + "/perf_context_test"; +const std::string kDbName = rocksdb::test::TmpDir() + "/perf_context_test"; -void SeekToFirst(leveldb::Iterator* iter) { +void SeekToFirst(rocksdb::Iterator* iter) { // std::cout << "Press a key to continue:"; // std::string s; // std::cin >> s; @@ -30,7 +30,7 @@ void SeekToFirst(leveldb::Iterator* iter) { // std::cin >> s2; } -namespace leveldb { +namespace rocksdb { std::shared_ptr OpenDb() { DB* db; @@ -42,9 +42,9 @@ std::shared_ptr OpenDb() { FLAGS_min_write_buffer_number_to_merge; if (FLAGS_use_set_based_memetable) { - auto prefix_extractor = leveldb::NewFixedPrefixTransform(0); + auto prefix_extractor = rocksdb::NewFixedPrefixTransform(0); options.memtable_factory = - std::make_shared(prefix_extractor); + std::make_shared(prefix_extractor); } Status s = DB::Open(options, kDbName, &db); @@ -315,6 +315,6 @@ int main(int argc, char** argv) { std::cout << kDbName << "\n"; - leveldb::test::RunAllTests(); + rocksdb::test::RunAllTests(); return 0; } diff --git a/db/prefix_filter_iterator.h b/db/prefix_filter_iterator.h index 6b55c931a..8be7dea56 100644 --- a/db/prefix_filter_iterator.h +++ b/db/prefix_filter_iterator.h @@ -14,7 +14,7 @@ #include "rocksdb/iterator.h" -namespace leveldb { +namespace rocksdb { class PrefixFilterIterator : public Iterator { private: @@ -71,6 +71,6 @@ class PrefixFilterIterator : public Iterator { } }; -} // namespace leveldb +} // namespace rocksdb #endif diff --git a/db/repair.cc b/db/repair.cc index 23a2b7935..bc9cdd586 100644 --- a/db/repair.cc +++ b/db/repair.cc @@ -38,7 +38,7 @@ #include "rocksdb/db.h" #include "rocksdb/env.h" -namespace leveldb { +namespace rocksdb { namespace { @@ -383,4 +383,4 @@ Status RepairDB(const std::string& dbname, const Options& options) { return repairer.Run(); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/skiplist.h b/db/skiplist.h index 342eb4dd4..97f1b9b3e 100644 --- a/db/skiplist.h +++ b/db/skiplist.h @@ -33,7 +33,7 @@ #include "port/port.h" #include "util/random.h" -namespace leveldb { +namespace rocksdb { template class SkipList { @@ -400,6 +400,6 @@ bool SkipList::Contains(const Key& key) const { } } -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_SKIPLIST_H_ diff --git a/db/skiplist_test.cc b/db/skiplist_test.cc index 4f3ab4541..73fd91659 100644 --- a/db/skiplist_test.cc +++ b/db/skiplist_test.cc @@ -10,7 +10,7 @@ #include "util/random.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { typedef uint64_t Key; @@ -371,8 +371,8 @@ TEST(SkipTest, Concurrent3) { RunConcurrent(3); } TEST(SkipTest, Concurrent4) { RunConcurrent(4); } TEST(SkipTest, Concurrent5) { RunConcurrent(5); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/snapshot.h b/db/snapshot.h index cc1498e44..a3c725a38 100644 --- a/db/snapshot.h +++ b/db/snapshot.h @@ -7,7 +7,7 @@ #include "rocksdb/db.h" -namespace leveldb { +namespace rocksdb { class SnapshotList; @@ -80,6 +80,6 @@ class SnapshotList { SnapshotImpl list_; }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_SNAPSHOT_H_ diff --git a/db/table_cache.cc b/db/table_cache.cc index dc8769f48..cf544fefe 100644 --- a/db/table_cache.cc +++ b/db/table_cache.cc @@ -11,7 +11,7 @@ #include "util/coding.h" #include "util/stop_watch.h" -namespace leveldb { +namespace rocksdb { static void DeleteEntry(const Slice& key, void* value) { Table* table = reinterpret_cast(value); @@ -160,4 +160,4 @@ void TableCache::Evict(uint64_t file_number) { cache_->Erase(Slice(buf, sizeof(buf))); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/table_cache.h b/db/table_cache.h index c9e68738b..86afd0ea0 100644 --- a/db/table_cache.h +++ b/db/table_cache.h @@ -15,7 +15,7 @@ #include "port/port.h" #include "table/table.h" -namespace leveldb { +namespace rocksdb { class Env; @@ -72,6 +72,6 @@ class TableCache { const bool no_io = false); }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_TABLE_CACHE_H_ diff --git a/db/transaction_log_impl.cc b/db/transaction_log_impl.cc index 6de0bd9cf..b8bb3c253 100644 --- a/db/transaction_log_impl.cc +++ b/db/transaction_log_impl.cc @@ -1,7 +1,7 @@ #include "db/transaction_log_impl.h" #include "db/write_batch_internal.h" -namespace leveldb { +namespace rocksdb { TransactionLogIteratorImpl::TransactionLogIteratorImpl( const std::string& dbname, @@ -168,4 +168,4 @@ Status TransactionLogIteratorImpl::OpenLogReader(const LogFile* logFile) { ); return Status::OK(); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/transaction_log_impl.h b/db/transaction_log_impl.h index a3ca1c00c..a26f854d6 100644 --- a/db/transaction_log_impl.h +++ b/db/transaction_log_impl.h @@ -11,7 +11,7 @@ #include "db/log_reader.h" #include "db/filename.h" -namespace leveldb { +namespace rocksdb { struct LogReporter : public log::Reader::Reporter { Env* env; @@ -99,5 +99,5 @@ class TransactionLogIteratorImpl : public TransactionLogIterator { -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_INCLUDE_WRITES_ITERATOR_IMPL_H_ diff --git a/db/version_edit.cc b/db/version_edit.cc index b72f8c6fb..39b1c195f 100644 --- a/db/version_edit.cc +++ b/db/version_edit.cc @@ -7,7 +7,7 @@ #include "db/version_set.h" #include "util/coding.h" -namespace leveldb { +namespace rocksdb { // Tag numbers for serialized VersionEdit. These numbers are written to // disk and should not be changed. @@ -293,4 +293,4 @@ std::string VersionEdit::DebugString(bool hex_key) const { return r; } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/version_edit.h b/db/version_edit.h index ee99e206d..2ea8da522 100644 --- a/db/version_edit.h +++ b/db/version_edit.h @@ -10,7 +10,7 @@ #include #include "db/dbformat.h" -namespace leveldb { +namespace rocksdb { class VersionSet; @@ -122,6 +122,6 @@ class VersionEdit { std::vector< std::pair > new_files_; }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_VERSION_EDIT_H_ diff --git a/db/version_edit_test.cc b/db/version_edit_test.cc index 26b69199e..1b80c1e88 100644 --- a/db/version_edit_test.cc +++ b/db/version_edit_test.cc @@ -5,7 +5,7 @@ #include "db/version_edit.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { static void TestEncodeDecode(const VersionEdit& edit) { std::string encoded, encoded2; @@ -41,8 +41,8 @@ TEST(VersionEditTest, EncodeDecode) { TestEncodeDecode(edit); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/version_set.cc b/db/version_set.cc index 8221747af..20de9f6e3 100644 --- a/db/version_set.cc +++ b/db/version_set.cc @@ -21,7 +21,7 @@ #include "util/logging.h" #include "util/stop_watch.h" -namespace leveldb { +namespace rocksdb { static uint64_t TotalFileSize(const std::vector& files) { uint64_t sum = 0; @@ -3055,4 +3055,4 @@ void Compaction::Summary(char* output, int len) { level_low_summary, level_up_summary); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/version_set.h b/db/version_set.h index 2004fe363..42de376f3 100644 --- a/db/version_set.h +++ b/db/version_set.h @@ -25,7 +25,7 @@ #include "port/port.h" #include "db/table_cache.h" -namespace leveldb { +namespace rocksdb { namespace log { class Writer; } @@ -627,6 +627,6 @@ class Compaction { void ResetNextCompactionIndex(); }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_VERSION_SET_H_ diff --git a/db/version_set_reduce_num_levels.cc b/db/version_set_reduce_num_levels.cc index 574a45c44..e36a5106c 100644 --- a/db/version_set_reduce_num_levels.cc +++ b/db/version_set_reduce_num_levels.cc @@ -10,7 +10,7 @@ #include "db/log_writer.h" #include "util/logging.h" -namespace leveldb { +namespace rocksdb { Status VersionSet::ReduceNumberOfLevels(int new_levels, port::Mutex* mu) { diff --git a/db/version_set_test.cc b/db/version_set_test.cc index 17424e1ba..e661a5d32 100644 --- a/db/version_set_test.cc +++ b/db/version_set_test.cc @@ -7,7 +7,7 @@ #include "util/testharness.h" #include "util/testutil.h" -namespace leveldb { +namespace rocksdb { class FindFileTest { public: @@ -172,8 +172,8 @@ TEST(FindFileTest, OverlappingFiles) { ASSERT_TRUE(Overlaps("600", "700")); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/db/write_batch.cc b/db/write_batch.cc index 8cd9227ef..b58564c6f 100644 --- a/db/write_batch.cc +++ b/db/write_batch.cc @@ -26,7 +26,7 @@ #include "util/coding.h" #include -namespace leveldb { +namespace rocksdb { // WriteBatch header has an 8-byte sequence number followed by a 4-byte count. static const size_t kHeader = 12; @@ -227,4 +227,4 @@ void WriteBatchInternal::Append(WriteBatch* dst, const WriteBatch* src) { dst->rep_.append(src->rep_.data() + kHeader, src->rep_.size() - kHeader); } -} // namespace leveldb +} // namespace rocksdb diff --git a/db/write_batch_internal.h b/db/write_batch_internal.h index 962f2a88c..f532844c5 100644 --- a/db/write_batch_internal.h +++ b/db/write_batch_internal.h @@ -10,7 +10,7 @@ #include "rocksdb/db.h" #include "rocksdb/options.h" -namespace leveldb { +namespace rocksdb { class MemTable; @@ -51,7 +51,7 @@ class WriteBatchInternal { static void Append(WriteBatch* dst, const WriteBatch* src); }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_ diff --git a/db/write_batch_test.cc b/db/write_batch_test.cc index d03c46fbc..00197a2a0 100644 --- a/db/write_batch_test.cc +++ b/db/write_batch_test.cc @@ -12,7 +12,7 @@ #include "util/logging.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { static std::string PrintContents(WriteBatch* b) { InternalKeyComparator cmp(BytewiseComparator()); @@ -221,8 +221,8 @@ TEST(WriteBatchTest, Continue) { handler.seen); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/doc/bench/db_bench_sqlite3.cc b/doc/bench/db_bench_sqlite3.cc index 256793a9d..81d26d41d 100644 --- a/doc/bench/db_bench_sqlite3.cc +++ b/doc/bench/db_bench_sqlite3.cc @@ -111,7 +111,7 @@ static void WalCheckpoint(sqlite3* db_) { } } -namespace leveldb { +namespace rocksdb { // Helper for quickly generating random data. namespace { @@ -664,7 +664,7 @@ class Benchmark { }; -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { std::string default_db_path; @@ -672,7 +672,7 @@ int main(int argc, char** argv) { double d; int n; char junk; - if (leveldb::Slice(argv[i]).starts_with("--benchmarks=")) { + if (rocksdb::Slice(argv[i]).starts_with("--benchmarks=")) { FLAGS_benchmarks = argv[i] + strlen("--benchmarks="); } else if (sscanf(argv[i], "--histogram=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) { @@ -688,7 +688,7 @@ int main(int argc, char** argv) { FLAGS_reads = n; } else if (sscanf(argv[i], "--value_size=%d%c", &n, &junk) == 1) { FLAGS_value_size = n; - } else if (leveldb::Slice(argv[i]) == leveldb::Slice("--no_transaction")) { + } else if (rocksdb::Slice(argv[i]) == rocksdb::Slice("--no_transaction")) { FLAGS_transaction = false; } else if (sscanf(argv[i], "--page_size=%d%c", &n, &junk) == 1) { FLAGS_page_size = n; @@ -707,12 +707,12 @@ int main(int argc, char** argv) { // Choose a location for the test database if none given with --db= if (FLAGS_db == NULL) { - leveldb::Env::Default()->GetTestDirectory(&default_db_path); + rocksdb::Env::Default()->GetTestDirectory(&default_db_path); default_db_path += "/dbbench"; FLAGS_db = default_db_path.c_str(); } - leveldb::Benchmark benchmark; + rocksdb::Benchmark benchmark; benchmark.Run(); return 0; } diff --git a/doc/bench/db_bench_tree_db.cc b/doc/bench/db_bench_tree_db.cc index ed86f031c..ab24a018f 100644 --- a/doc/bench/db_bench_tree_db.cc +++ b/doc/bench/db_bench_tree_db.cc @@ -80,7 +80,7 @@ static void DBSynchronize(kyotocabinet::TreeDB* db_) } } -namespace leveldb { +namespace rocksdb { // Helper for quickly generating random data. namespace { @@ -479,7 +479,7 @@ class Benchmark { } }; -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { std::string default_db_path; @@ -487,7 +487,7 @@ int main(int argc, char** argv) { double d; int n; char junk; - if (leveldb::Slice(argv[i]).starts_with("--benchmarks=")) { + if (rocksdb::Slice(argv[i]).starts_with("--benchmarks=")) { FLAGS_benchmarks = argv[i] + strlen("--benchmarks="); } else if (sscanf(argv[i], "--compression_ratio=%lf%c", &d, &junk) == 1) { FLAGS_compression_ratio = d; @@ -517,12 +517,12 @@ int main(int argc, char** argv) { // Choose a location for the test database if none given with --db= if (FLAGS_db == NULL) { - leveldb::Env::Default()->GetTestDirectory(&default_db_path); + rocksdb::Env::Default()->GetTestDirectory(&default_db_path); default_db_path += "/dbbench"; FLAGS_db = default_db_path.c_str(); } - leveldb::Benchmark benchmark; + rocksdb::Benchmark benchmark; benchmark.Run(); return 0; } diff --git a/doc/index.html b/doc/index.html index 521d2baf4..a6183b9ab 100644 --- a/doc/index.html +++ b/doc/index.html @@ -25,27 +25,27 @@ creating it if necessary: #include <assert> #include "leveldb/db.h" - leveldb::DB* db; - leveldb::Options options; + rocksdb::DB* db; + rocksdb::Options options; options.create_if_missing = true; - leveldb::Status status = leveldb::DB::Open(options, "/tmp/testdb", &db); + rocksdb::Status status = rocksdb::DB::Open(options, "/tmp/testdb", &db); assert(status.ok()); ... If you want to raise an error if the database already exists, add -the following line before the leveldb::DB::Open call: +the following line before the rocksdb::DB::Open call:
   options.error_if_exists = true;
 

Status

-You may have noticed the leveldb::Status type above. Values of this +You may have noticed the rocksdb::Status type above. Values of this type are returned by most functions in leveldb that may encounter an error. You can check if such a result is ok, and also print an associated error message:

-   leveldb::Status s = ...;
+   rocksdb::Status s = ...;
    if (!s.ok()) cerr << s.ToString() << endl;
 

Closing A Database

@@ -65,9 +65,9 @@ modify/query the database. For example, the following code moves the value stored under key1 to key2.
   std::string value;
-  leveldb::Status s = db->Get(leveldb::ReadOptions(), key1, &value);
-  if (s.ok()) s = db->Put(leveldb::WriteOptions(), key2, value);
-  if (s.ok()) s = db->Delete(leveldb::WriteOptions(), key1);
+  rocksdb::Status s = db->Get(rocksdb::ReadOptions(), key1, &value);
+  if (s.ok()) s = db->Put(rocksdb::WriteOptions(), key2, value);
+  if (s.ok()) s = db->Delete(rocksdb::WriteOptions(), key1);
 

Atomic Updates

@@ -81,12 +81,12 @@ atomically apply a set of updates: #include "leveldb/write_batch.h" ... std::string value; - leveldb::Status s = db->Get(leveldb::ReadOptions(), key1, &value); + rocksdb::Status s = db->Get(rocksdb::ReadOptions(), key1, &value); if (s.ok()) { - leveldb::WriteBatch batch; + rocksdb::WriteBatch batch; batch.Delete(key1); batch.Put(key2, value); - s = db->Write(leveldb::WriteOptions(), &batch); + s = db->Write(rocksdb::WriteOptions(), &batch); } The WriteBatch holds a sequence of edits to be made to the database, @@ -109,7 +109,7 @@ persistent storage. (On Posix systems, this is implemented by calling either fsync(...) or fdatasync(...) or msync(..., MS_SYNC) before the write operation returns.)
-  leveldb::WriteOptions write_options;
+  rocksdb::WriteOptions write_options;
   write_options.sync = true;
   db->Put(write_options, ...);
 
@@ -144,7 +144,7 @@ the batch. A database may only be opened by one process at a time. The leveldb implementation acquires a lock from the operating system to prevent misuse. Within a single process, the -same leveldb::DB object may be safely shared by multiple +same rocksdb::DB object may be safely shared by multiple concurrent threads. I.e., different threads may write into or fetch iterators or call Get on the same database without any external synchronization (the leveldb implementation will @@ -160,7 +160,7 @@ The following example demonstrates how to print all key,value pairs in a database.

-  leveldb::Iterator* it = db->NewIterator(leveldb::ReadOptions());
+  rocksdb::Iterator* it = db->NewIterator(rocksdb::ReadOptions());
   for (it->SeekToFirst(); it->Valid(); it->Next()) {
     cout << it->key().ToString() << ": "  << it->value().ToString() << endl;
   }
@@ -196,10 +196,10 @@ implicit snapshot of the current state.
 Snapshots are created by the DB::GetSnapshot() method:
 

-  leveldb::ReadOptions options;
+  rocksdb::ReadOptions options;
   options.snapshot = db->GetSnapshot();
   ... apply some updates to db ...
-  leveldb::Iterator* iter = db->NewIterator(options);
+  rocksdb::Iterator* iter = db->NewIterator(options);
   ... read using iter to view the state when the snapshot was created ...
   delete iter;
   db->ReleaseSnapshot(options.snapshot);
@@ -211,7 +211,7 @@ support reading as of that snapshot.
 

Slice

The return value of the it->key() and it->value() calls above -are instances of the leveldb::Slice type. Slice is a simple +are instances of the rocksdb::Slice type. Slice is a simple structure that contains a length and a pointer to an external byte array. Returning a Slice is a cheaper alternative to returning a std::string since we do not need to copy potentially large keys and @@ -223,10 +223,10 @@ C++ strings and null-terminated C-style strings can be easily converted to a Slice:

-   leveldb::Slice s1 = "hello";
+   rocksdb::Slice s1 = "hello";
 
    std::string str("world");
-   leveldb::Slice s2 = str;
+   rocksdb::Slice s2 = str;
 
A Slice can be easily converted back to a C++ string:
@@ -238,7 +238,7 @@ the external byte array into which the Slice points remains live while
 the Slice is in use.  For example, the following is buggy:
 

-   leveldb::Slice slice;
+   rocksdb::Slice slice;
    if (...) {
      std::string str = ...;
      slice = str;
@@ -255,16 +255,16 @@ which orders bytes lexicographically.  You can however supply a custom
 comparator when opening a database.  For example, suppose each
 database key consists of two numbers and we should sort by the first
 number, breaking ties by the second number.  First, define a proper
-subclass of leveldb::Comparator that expresses these rules:
+subclass of rocksdb::Comparator that expresses these rules:
 

-  class TwoPartComparator : public leveldb::Comparator {
+  class TwoPartComparator : public rocksdb::Comparator {
    public:
     // Three-way comparison function:
     //   if a < b: negative result
     //   if a > b: positive result
     //   else: zero result
-    int Compare(const leveldb::Slice& a, const leveldb::Slice& b) const {
+    int Compare(const rocksdb::Slice& a, const rocksdb::Slice& b) const {
       int a1, a2, b1, b2;
       ParseKey(a, &a1, &a2);
       ParseKey(b, &b1, &b2);
@@ -277,7 +277,7 @@ subclass of leveldb::Comparator that expresses these rules:
 
     // Ignore the following methods for now:
     const char* Name() const { return "TwoPartComparator"; }
-    void FindShortestSeparator(std::string*, const leveldb::Slice&) const { }
+    void FindShortestSeparator(std::string*, const rocksdb::Slice&) const { }
     void FindShortSuccessor(std::string*) const { }
   };
 
@@ -285,18 +285,18 @@ Now create a database using this custom comparator:

   TwoPartComparator cmp;
-  leveldb::DB* db;
-  leveldb::Options options;
+  rocksdb::DB* db;
+  rocksdb::Options options;
   options.create_if_missing = true;
   options.comparator = &cmp;
-  leveldb::Status status = leveldb::DB::Open(options, "/tmp/testdb", &db);
+  rocksdb::Status status = rocksdb::DB::Open(options, "/tmp/testdb", &db);
   ...
 

Backwards compatibility

The result of the comparator's Name method is attached to the database when it is created, and is checked on every subsequent -database open. If the name changes, the leveldb::DB::Open call will +database open. If the name changes, the rocksdb::DB::Open call will fail. Therefore, change the name if and only if the new key format and comparison function are incompatible with existing databases, and it is ok to discard the contents of all existing databases. @@ -339,9 +339,9 @@ compression entirely, but should only do so if benchmarks show a performance improvement:

-  leveldb::Options options;
-  options.compression = leveldb::kNoCompression;
-  ... leveldb::DB::Open(options, name, ...) ....
+  rocksdb::Options options;
+  options.compression = rocksdb::kNoCompression;
+  ... rocksdb::DB::Open(options, name, ...) ....
 

Cache

@@ -353,10 +353,10 @@ uncompressed block contents.

   #include "leveldb/cache.h"
 
-  leveldb::Options options;
-  options.cache = leveldb::NewLRUCache(100 * 1048576);  // 100MB cache
-  leveldb::DB* db;
-  leveldb::DB::Open(options, name, &db);
+  rocksdb::Options options;
+  options.cache = rocksdb::NewLRUCache(100 * 1048576);  // 100MB cache
+  rocksdb::DB* db;
+  rocksdb::DB::Open(options, name, &db);
   ... use the db ...
   delete db
   delete options.cache;
@@ -373,9 +373,9 @@ displacing most of the cached contents.  A per-iterator option can be
 used to achieve this:
 

-  leveldb::ReadOptions options;
+  rocksdb::ReadOptions options;
   options.fill_cache = false;
-  leveldb::Iterator* it = db->NewIterator(options);
+  rocksdb::Iterator* it = db->NewIterator(options);
   for (it->SeekToFirst(); it->Valid(); it->Next()) {
     ...
   }
@@ -407,10 +407,10 @@ a single Get() call may involve multiple reads from disk.
 The optional FilterPolicy mechanism can be used to reduce
 the number of disk reads substantially.
 
-   leveldb::Options options;
+   rocksdb::Options options;
    options.filter_policy = NewBloomFilter(10);
-   leveldb::DB* db;
-   leveldb::DB::Open(options, "/tmp/testdb", &db);
+   rocksdb::DB* db;
+   rocksdb::DB::Open(options, "/tmp/testdb", &db);
    ... use the database ...
    delete db;
    delete options.filter_policy;
@@ -434,7 +434,7 @@ consider a comparator that ignores trailing spaces when comparing keys.
 Instead, the application should provide a custom filter policy that
 also ignores trailing spaces.  For example:
 
-  class CustomFilterPolicy : public leveldb::FilterPolicy {
+  class CustomFilterPolicy : public rocksdb::FilterPolicy {
    private:
     FilterPolicy* builtin_policy_;
    public:
@@ -484,7 +484,7 @@ checksums are verified:
   parts of its persistent storage have been corrupted.
 

If a database is corrupted (perhaps it cannot be opened when - paranoid checking is turned on), the leveldb::RepairDB function + paranoid checking is turned on), the rocksdb::RepairDB function may be used to recover as much of the data as possible

@@ -494,11 +494,11 @@ The GetApproximateSizes method can used to get the approximate number of bytes of file system space used by one or more key ranges.

-   leveldb::Range ranges[2];
-   ranges[0] = leveldb::Range("a", "c");
-   ranges[1] = leveldb::Range("x", "z");
+   rocksdb::Range ranges[2];
+   ranges[0] = rocksdb::Range("a", "c");
+   ranges[1] = rocksdb::Range("x", "z");
    uint64_t sizes[2];
-   leveldb::Status s = db->GetApproximateSizes(ranges, 2, sizes);
+   rocksdb::Status s = db->GetApproximateSizes(ranges, 2, sizes);
 
The preceding call will set sizes[0] to the approximate number of bytes of file system space used by the key range [a..c) and @@ -508,21 +508,21 @@ bytes of file system space used by the key range [a..c) and

Environment

All file operations (and other operating system calls) issued by the -leveldb implementation are routed through a leveldb::Env object. +leveldb implementation are routed through a rocksdb::Env object. Sophisticated clients may wish to provide their own Env implementation to get better control. For example, an application may introduce artificial delays in the file IO paths to limit the impact of leveldb on other activities in the system.

-  class SlowEnv : public leveldb::Env {
+  class SlowEnv : public rocksdb::Env {
     .. implementation of the Env interface ...
   };
 
   SlowEnv env;
-  leveldb::Options options;
+  rocksdb::Options options;
   options.env = &env;
-  Status s = leveldb::DB::Open(options, ...);
+  Status s = rocksdb::DB::Open(options, ...);
 

Porting

@@ -531,7 +531,7 @@ specific implementations of the types/methods/functions exported by leveldb/port/port.h. See leveldb/port/port_example.h for more details.

-In addition, the new platform may need a new default leveldb::Env +In addition, the new platform may need a new default rocksdb::Env implementation. See leveldb/util/env_posix.h for an example.

Other Information

diff --git a/hdfs/env_hdfs.h b/hdfs/env_hdfs.h index b9309b3a1..0098c0d32 100644 --- a/hdfs/env_hdfs.h +++ b/hdfs/env_hdfs.h @@ -31,7 +31,7 @@ #ifdef USE_HDFS #include "hdfs/hdfs.h" -namespace leveldb { +namespace rocksdb { static const std::string kProto = "hdfs://"; static const std::string pathsep = "/"; @@ -214,12 +214,12 @@ class HdfsEnv : public Env { } }; -} // namespace leveldb +} // namespace rocksdb #else // USE_HDFS -namespace leveldb { +namespace rocksdb { static const Status notsup; diff --git a/helpers/memenv/memenv.cc b/helpers/memenv/memenv.cc index 5524e9341..15f1383a6 100644 --- a/helpers/memenv/memenv.cc +++ b/helpers/memenv/memenv.cc @@ -13,7 +13,7 @@ #include #include -namespace leveldb { +namespace rocksdb { namespace { @@ -383,4 +383,4 @@ Env* NewMemEnv(Env* base_env) { return new InMemoryEnv(base_env); } -} // namespace leveldb +} // namespace rocksdb diff --git a/helpers/memenv/memenv.h b/helpers/memenv/memenv.h index 59ebf65b0..21264411c 100644 --- a/helpers/memenv/memenv.h +++ b/helpers/memenv/memenv.h @@ -4,7 +4,7 @@ #ifndef STORAGE_ROCKSDB_HELPERS_MEMENV_MEMENV_H_ #define STORAGE_ROCKSDB_HELPERS_MEMENV_MEMENV_H_ -namespace leveldb { +namespace rocksdb { class Env; @@ -14,6 +14,6 @@ class Env; // *base_env must remain live while the result is in use. Env* NewMemEnv(Env* base_env); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_ROCKSDB_HELPERS_MEMENV_MEMENV_H_ diff --git a/helpers/memenv/memenv_test.cc b/helpers/memenv/memenv_test.cc index ab04b2597..7cdc2bbeb 100644 --- a/helpers/memenv/memenv_test.cc +++ b/helpers/memenv/memenv_test.cc @@ -12,7 +12,7 @@ #include #include -namespace leveldb { +namespace rocksdb { class MemEnvTest { public: @@ -226,8 +226,8 @@ TEST(MemEnvTest, DBTest) { delete db; } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/include/rocksdb/arena.h b/include/rocksdb/arena.h index 3057d4e28..c6a87ab9c 100644 --- a/include/rocksdb/arena.h +++ b/include/rocksdb/arena.h @@ -11,7 +11,7 @@ #include #include -namespace leveldb { +namespace rocksdb { class Arena { public: @@ -36,6 +36,8 @@ class Arena { void operator=(const Arena&); }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_ARENA_H_ diff --git a/include/rocksdb/cache.h b/include/rocksdb/cache.h index b43faf2de..7ef6bd924 100644 --- a/include/rocksdb/cache.h +++ b/include/rocksdb/cache.h @@ -22,7 +22,7 @@ #include #include "rocksdb/slice.h" -namespace leveldb { +namespace rocksdb { using std::shared_ptr; @@ -101,6 +101,8 @@ class Cache { void operator=(const Cache&); }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_UTIL_CACHE_H_ diff --git a/include/rocksdb/compaction_filter.h b/include/rocksdb/compaction_filter.h index 9f83d43d3..fe9ce1f0d 100644 --- a/include/rocksdb/compaction_filter.h +++ b/include/rocksdb/compaction_filter.h @@ -7,7 +7,7 @@ #include -namespace leveldb { +namespace rocksdb { class Slice; @@ -66,6 +66,8 @@ class DefaultCompactionFilterFactory : public CompactionFilterFactory { } }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_COMPACTION_FILTER_H_ diff --git a/include/rocksdb/comparator.h b/include/rocksdb/comparator.h index 2a29973cd..a13e6520d 100644 --- a/include/rocksdb/comparator.h +++ b/include/rocksdb/comparator.h @@ -7,7 +7,7 @@ #include -namespace leveldb { +namespace rocksdb { class Slice; @@ -58,6 +58,8 @@ class Comparator { // must not be deleted. extern const Comparator* BytewiseComparator(); -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_COMPARATOR_H_ diff --git a/include/rocksdb/db.h b/include/rocksdb/db.h index 16bc4d48d..5e3e98960 100644 --- a/include/rocksdb/db.h +++ b/include/rocksdb/db.h @@ -14,7 +14,7 @@ #include "rocksdb/types.h" #include "rocksdb/transaction_log.h" -namespace leveldb { +namespace rocksdb { using std::unique_ptr; @@ -306,6 +306,8 @@ Status DestroyDB(const std::string& name, const Options& options); // on a database that contains important information. Status RepairDB(const std::string& dbname, const Options& options); -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_DB_H_ diff --git a/include/rocksdb/env.h b/include/rocksdb/env.h index 3e422d89e..be42428f3 100644 --- a/include/rocksdb/env.h +++ b/include/rocksdb/env.h @@ -20,7 +20,7 @@ #include #include "rocksdb/status.h" -namespace leveldb { +namespace rocksdb { class FileLock; class Logger; @@ -563,6 +563,8 @@ class EnvWrapper : public Env { Env* target_; }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_ENV_H_ diff --git a/include/rocksdb/filter_policy.h b/include/rocksdb/filter_policy.h index 42dd6f78a..aa2fd12f6 100644 --- a/include/rocksdb/filter_policy.h +++ b/include/rocksdb/filter_policy.h @@ -18,7 +18,7 @@ #include -namespace leveldb { +namespace rocksdb { class Slice; @@ -66,5 +66,6 @@ class FilterPolicy { extern const FilterPolicy* NewBloomFilterPolicy(int bits_per_key); } +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_FILTER_POLICY_H_ diff --git a/include/rocksdb/iterator.h b/include/rocksdb/iterator.h index 4270e95f7..966ce108a 100644 --- a/include/rocksdb/iterator.h +++ b/include/rocksdb/iterator.h @@ -18,7 +18,7 @@ #include "rocksdb/slice.h" #include "rocksdb/status.h" -namespace leveldb { +namespace rocksdb { class Iterator { public: @@ -97,6 +97,8 @@ extern Iterator* NewEmptyIterator(); // Return an empty iterator with the specified status. extern Iterator* NewErrorIterator(const Status& status); -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_ITERATOR_H_ diff --git a/include/rocksdb/ldb_tool.h b/include/rocksdb/ldb_tool.h index 53ef6a333..99c522bee 100644 --- a/include/rocksdb/ldb_tool.h +++ b/include/rocksdb/ldb_tool.h @@ -3,12 +3,18 @@ #define STORAGE_ROCKSDB_INCLUDE_LDB_TOOL_H #include "rocksdb/options.h" -namespace leveldb { +namespace rocksdb { class LDBTool { public: void Run(int argc, char** argv, Options = Options()); }; -} // namespace leveldb +namespace leveldb = rocksdb; + + +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" + #endif // STORAGE_ROCKSDB_INCLUDE_LDB_TOOL_H diff --git a/include/rocksdb/memtablerep.h b/include/rocksdb/memtablerep.h index 31275a77a..70419294d 100644 --- a/include/rocksdb/memtablerep.h +++ b/include/rocksdb/memtablerep.h @@ -44,7 +44,7 @@ #include "rocksdb/slice.h" #include "rocksdb/slice_transform.h" -namespace leveldb { +namespace rocksdb { class MemTableRep { public: @@ -256,4 +256,6 @@ public: } +#include "rocksdb/rocksdb_to_leveldb.h" + #endif // STORAGE_ROCKSDB_DB_MEMTABLEREP_H_ diff --git a/include/rocksdb/merge_operator.h b/include/rocksdb/merge_operator.h index d907c67a3..8d0a9f12f 100644 --- a/include/rocksdb/merge_operator.h +++ b/include/rocksdb/merge_operator.h @@ -9,7 +9,7 @@ #include #include "rocksdb/slice.h" // TODO: Remove this when migration is done; -namespace leveldb { +namespace rocksdb { class Slice; class Logger; @@ -142,6 +142,8 @@ class AssociativeMergeOperator : public MergeOperator { Logger* logger) const override; }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_MERGE_OPERATOR_H_ diff --git a/include/rocksdb/options.h b/include/rocksdb/options.h index eb4014a3f..e11445f72 100644 --- a/include/rocksdb/options.h +++ b/include/rocksdb/options.h @@ -16,7 +16,7 @@ #include "rocksdb/memtablerep.h" #include "rocksdb/slice_transform.h" -namespace leveldb { +namespace rocksdb { class Cache; class Comparator; @@ -673,6 +673,8 @@ struct FlushOptions { } }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_OPTIONS_H_ diff --git a/include/rocksdb/perf_context.h b/include/rocksdb/perf_context.h index 1e69189c7..eedefec56 100644 --- a/include/rocksdb/perf_context.h +++ b/include/rocksdb/perf_context.h @@ -3,7 +3,7 @@ #include -namespace leveldb { +namespace rocksdb { enum PerfLevel { kDisable = 0, // disable perf stats @@ -36,5 +36,6 @@ extern __thread PerfContext perf_context; } +#include "rocksdb/rocksdb_to_leveldb.h" #endif diff --git a/include/rocksdb/rocksdb_to_leveldb.h b/include/rocksdb/rocksdb_to_leveldb.h new file mode 100644 index 000000000..407efdbbb --- /dev/null +++ b/include/rocksdb/rocksdb_to_leveldb.h @@ -0,0 +1,9 @@ +// Copyright (c) 2013 Facebook. + +#pragma once + +// +// This is for backward compatibility with applications that use the +// 'leveldb' namespace. This file will be deleted in a future release. +// +namespace leveldb = rocksdb; diff --git a/include/rocksdb/slice.h b/include/rocksdb/slice.h index 4eac682ef..24d7004c2 100644 --- a/include/rocksdb/slice.h +++ b/include/rocksdb/slice.h @@ -20,7 +20,7 @@ #include #include -namespace leveldb { +namespace rocksdb { class Slice { public: @@ -117,6 +117,8 @@ inline int Slice::compare(const Slice& b) const { return r; } -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_SLICE_H_ diff --git a/include/rocksdb/slice_transform.h b/include/rocksdb/slice_transform.h index c46bb192f..917b50e68 100644 --- a/include/rocksdb/slice_transform.h +++ b/include/rocksdb/slice_transform.h @@ -13,7 +13,7 @@ #include -namespace leveldb { +namespace rocksdb { class Slice; @@ -40,4 +40,6 @@ extern const SliceTransform* NewNoopTransform(); } +#include "rocksdb/rocksdb_to_leveldb.h" + #endif // STORAGE_ROCKSDB_INCLUDE_SLICE_TRANSFORM_H_ diff --git a/include/rocksdb/statistics.h b/include/rocksdb/statistics.h index 15ffc8553..097b55b10 100644 --- a/include/rocksdb/statistics.h +++ b/include/rocksdb/statistics.h @@ -13,7 +13,7 @@ #include #include -namespace leveldb { +namespace rocksdb { /** * Keep adding ticker's here. @@ -258,6 +258,8 @@ inline void SetTickerCount(std::shared_ptr statistics, } } -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_STATISTICS_H_ diff --git a/include/rocksdb/status.h b/include/rocksdb/status.h index f3af5bfab..51a9b2d48 100644 --- a/include/rocksdb/status.h +++ b/include/rocksdb/status.h @@ -16,7 +16,7 @@ #include #include "rocksdb/slice.h" -namespace leveldb { +namespace rocksdb { class Status { public: @@ -121,6 +121,8 @@ inline void Status::operator=(const Status& s) { } } -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_STATUS_H_ diff --git a/include/rocksdb/table_builder.h b/include/rocksdb/table_builder.h index 4ae3c3eb2..077cc8ab1 100644 --- a/include/rocksdb/table_builder.h +++ b/include/rocksdb/table_builder.h @@ -17,7 +17,7 @@ #include "rocksdb/options.h" #include "rocksdb/status.h" -namespace leveldb { +namespace rocksdb { class BlockBuilder; class BlockHandle; @@ -90,6 +90,8 @@ class TableBuilder { void operator=(const TableBuilder&); }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_TABLE_BUILDER_H_ diff --git a/include/rocksdb/transaction_log.h b/include/rocksdb/transaction_log.h index bde29004d..73f011d9e 100644 --- a/include/rocksdb/transaction_log.h +++ b/include/rocksdb/transaction_log.h @@ -6,7 +6,7 @@ #include "rocksdb/types.h" #include "rocksdb/write_batch.h" -namespace leveldb { +namespace rocksdb { class LogFile; typedef std::vector> VectorLogPtr; @@ -76,6 +76,8 @@ class TransactionLogIterator { // ONLY use if Valid() is true and status() is OK. virtual BatchResult GetBatch() = 0; }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_TRANSACTION_LOG_ITERATOR_H_ diff --git a/include/rocksdb/types.h b/include/rocksdb/types.h index ad125324b..ee2ed4632 100644 --- a/include/rocksdb/types.h +++ b/include/rocksdb/types.h @@ -3,12 +3,15 @@ #include -namespace leveldb { +namespace rocksdb { // Define all public custom types here. // Represents a sequence number in a WAL file. typedef uint64_t SequenceNumber; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" + #endif // STORAGE_ROCKSDB_INCLUDE_TYPES_H_ diff --git a/include/rocksdb/universal_compaction.h b/include/rocksdb/universal_compaction.h index 771424ba3..777dd7965 100644 --- a/include/rocksdb/universal_compaction.h +++ b/include/rocksdb/universal_compaction.h @@ -14,7 +14,7 @@ #include "rocksdb/slice.h" #include "rocksdb/statistics.h" -namespace leveldb { +namespace rocksdb { // // Algorithm used to make a compaction request stop picking new files @@ -65,6 +65,8 @@ class CompactionOptionsUniversal { } }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_UNIVERSAL_COMPACTION_OPTIONS_H diff --git a/include/rocksdb/write_batch.h b/include/rocksdb/write_batch.h index 460402a60..1e0c9c2ef 100644 --- a/include/rocksdb/write_batch.h +++ b/include/rocksdb/write_batch.h @@ -24,7 +24,7 @@ #include #include "rocksdb/status.h" -namespace leveldb { +namespace rocksdb { class Slice; @@ -94,6 +94,8 @@ class WriteBatch { // Intentionally copyable }; -} // namespace leveldb +} // namespace rocksdb + +#include "rocksdb/rocksdb_to_leveldb.h" #endif // STORAGE_ROCKSDB_INCLUDE_WRITE_BATCH_H_ diff --git a/include/utilities/stackable_db.h b/include/utilities/stackable_db.h index c92d30dcb..eb5a98b30 100644 --- a/include/utilities/stackable_db.h +++ b/include/utilities/stackable_db.h @@ -7,7 +7,7 @@ #include "rocksdb/db.h" -namespace leveldb { +namespace rocksdb { // This class contains APIs to stack rocksdb wrappers.Eg. Stack TTL over base d class StackableDB : public DB { @@ -160,6 +160,6 @@ class StackableDB : public DB { StackableDB* sdb_; }; -} // namespace leveldb +} // namespace rocksdb #endif // LEVELDB_INCLUDE_UTILITIES_STACKABLE_DB_H_ diff --git a/include/utilities/utility_db.h b/include/utilities/utility_db.h index 7b4703fc2..11249a25a 100644 --- a/include/utilities/utility_db.h +++ b/include/utilities/utility_db.h @@ -7,7 +7,7 @@ #include "stackable_db.h" -namespace leveldb { +namespace rocksdb { // This class contains APIs to open leveldb with specific support eg. TTL class UtilityDB { @@ -49,6 +49,6 @@ class UtilityDB { bool read_only = false); }; -} // namespace leveldb +} // namespace rocksdb #endif // LEVELDB_INCLUDE_UTILITIES_UTILITY_DB_H_ diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCache.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCache.java index 056249760..ebc7cd493 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCache.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCache.java @@ -39,19 +39,19 @@ import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_DELETE; /** - * Provides a java interface to the C++ leveldb::Cache class. + * Provides a java interface to the C++ rocksdb::Cache class. * * @author Hiram Chirino */ public class NativeCache extends NativeObject { - @JniClass(name="leveldb::Cache", flags={CPP}) + @JniClass(name="rocksdb::Cache", flags={CPP}) private static class CacheJNI { static { NativeDB.LIBRARY.load(); } - @JniMethod(cast="leveldb::Cache *", accessor="leveldb::NewLRUCache") + @JniMethod(cast="rocksdb::Cache *", accessor="rocksdb::NewLRUCache") public static final native long NewLRUCache( @JniArg(cast="size_t") long capacity); diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeComparator.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeComparator.java index f2f85853e..350a7b570 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeComparator.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeComparator.java @@ -40,7 +40,7 @@ import static org.fusesource.hawtjni.runtime.ClassFlag.*; /** *

- * Provides a java interface to the C++ leveldb::Comparator class. + * Provides a java interface to the C++ rocksdb::Comparator class. *

* * @author Hiram Chirino @@ -85,7 +85,7 @@ public abstract class NativeComparator extends NativeObject { @JniField(flags={CONSTANT}, accessor="sizeof(struct JNIComparator)") static int SIZEOF; - @JniField(flags={CONSTANT}, cast="const Comparator*", accessor="leveldb::BytewiseComparator()") + @JniField(flags={CONSTANT}, cast="const Comparator*", accessor="rocksdb::BytewiseComparator()") private static long BYTEWISE_COMPARATOR; } diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCompressionType.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCompressionType.java index 2c8b97b96..e3d5411ef 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCompressionType.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeCompressionType.java @@ -32,7 +32,7 @@ package org.fusesource.leveldbjni.internal; /** - * Provides a java interface to the C++ leveldb::CompressionType enum. + * Provides a java interface to the C++ rocksdb::CompressionType enum. * * @author Hiram Chirino */ diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeDB.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeDB.java index 37ed4fdba..606114098 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeDB.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeDB.java @@ -52,7 +52,7 @@ public class NativeDB extends NativeObject { public static final Library LIBRARY = new Library("leveldbjni", NativeDB.class); - @JniClass(name="leveldb::DB", flags={CPP}) + @JniClass(name="rocksdb::DB", flags={CPP}) static class DBJNI { static { NativeDB.LIBRARY.load(); @@ -79,13 +79,13 @@ public class NativeDB extends NativeObject { long self ); - @JniMethod(copy="leveldb::Status", accessor = "leveldb::DB::Open") + @JniMethod(copy="rocksdb::Status", accessor = "rocksdb::DB::Open") static final native long Open( @JniArg(flags={BY_VALUE, NO_OUT}) NativeOptions options, @JniArg(cast="const char*") String path, - @JniArg(cast="leveldb::DB**") long[] self); + @JniArg(cast="rocksdb::DB**") long[] self); - @JniMethod(copy="leveldb::Status", flags={CPP_METHOD}) + @JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) static final native long Put( long self, @JniArg(flags={BY_VALUE, NO_OUT}) NativeWriteOptions options, @@ -93,21 +93,21 @@ public class NativeDB extends NativeObject { @JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice value ); - @JniMethod(copy="leveldb::Status", flags={CPP_METHOD}) + @JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) static final native long Delete( long self, @JniArg(flags={BY_VALUE, NO_OUT}) NativeWriteOptions options, @JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice key ); - @JniMethod(copy="leveldb::Status", flags={CPP_METHOD}) + @JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) static final native long Write( long self, @JniArg(flags={BY_VALUE}) NativeWriteOptions options, - @JniArg(cast="leveldb::WriteBatch *") long updates + @JniArg(cast="rocksdb::WriteBatch *") long updates ); - @JniMethod(copy="leveldb::Status", flags={CPP_METHOD}) + @JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) static final native long Get( long self, @JniArg(flags={NO_OUT, BY_VALUE}) NativeReadOptions options, @@ -115,26 +115,26 @@ public class NativeDB extends NativeObject { @JniArg(cast="std::string *") long value ); - @JniMethod(cast="leveldb::Iterator *", flags={CPP_METHOD}) + @JniMethod(cast="rocksdb::Iterator *", flags={CPP_METHOD}) static final native long NewIterator( long self, @JniArg(flags={NO_OUT, BY_VALUE}) NativeReadOptions options ); - @JniMethod(cast="leveldb::Snapshot *", flags={CPP_METHOD}) + @JniMethod(cast="rocksdb::Snapshot *", flags={CPP_METHOD}) static final native long GetSnapshot( long self); @JniMethod(flags={CPP_METHOD}) static final native void ReleaseSnapshot( long self, - @JniArg(cast="const leveldb::Snapshot *") long snapshot + @JniArg(cast="const rocksdb::Snapshot *") long snapshot ); @JniMethod(flags={CPP_METHOD}) static final native void GetApproximateSizes( long self, - @JniArg(cast="const leveldb::Range *") long range, + @JniArg(cast="const rocksdb::Range *") long range, int n, @JniArg(cast="uint64_t*") long[] sizes ); @@ -146,12 +146,12 @@ public class NativeDB extends NativeObject { @JniArg(cast="std::string *") long value ); - @JniMethod(copy="leveldb::Status", accessor = "leveldb::DestroyDB") + @JniMethod(copy="rocksdb::Status", accessor = "rocksdb::DestroyDB") static final native long DestroyDB( @JniArg(cast="const char*") String path, @JniArg(flags={BY_VALUE, NO_OUT}) NativeOptions options); - @JniMethod(copy="leveldb::Status", accessor = "leveldb::RepairDB") + @JniMethod(copy="rocksdb::Status", accessor = "rocksdb::RepairDB") static final native long RepairDB( @JniArg(cast="const char*") String path, @JniArg(flags={BY_VALUE, NO_OUT}) NativeOptions options); diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeIterator.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeIterator.java index bf40b1901..b1883d1c8 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeIterator.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeIterator.java @@ -38,13 +38,13 @@ import static org.fusesource.hawtjni.runtime.ArgFlag.*; import static org.fusesource.hawtjni.runtime.ClassFlag.*; /** - * Provides a java interface to the C++ leveldb::Iterator class. + * Provides a java interface to the C++ rocksdb::Iterator class. * * @author Hiram Chirino */ public class NativeIterator extends NativeObject { - @JniClass(name="leveldb::Iterator", flags={CPP}) + @JniClass(name="rocksdb::Iterator", flags={CPP}) private static class IteratorJNI { static { NativeDB.LIBRARY.load(); @@ -86,17 +86,17 @@ public class NativeIterator extends NativeObject { long self ); - @JniMethod(copy="leveldb::Slice", flags={CPP_METHOD}) + @JniMethod(copy="rocksdb::Slice", flags={CPP_METHOD}) static final native long key( long self ); - @JniMethod(copy="leveldb::Slice", flags={CPP_METHOD}) + @JniMethod(copy="rocksdb::Slice", flags={CPP_METHOD}) static final native long value( long self ); - @JniMethod(copy="leveldb::Status", flags={CPP_METHOD}) + @JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) static final native long status( long self ); diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeLogger.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeLogger.java index 10f83e44a..e84cf282f 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeLogger.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeLogger.java @@ -46,7 +46,7 @@ import static org.fusesource.hawtjni.runtime.MethodFlag.*; /** *

- * Provides a java interface to the C++ leveldb::Logger class. + * Provides a java interface to the C++ rocksdb::Logger class. *

* * @author Hiram Chirino diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeOptions.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeOptions.java index dafbb5888..ed6f0014f 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeOptions.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeOptions.java @@ -42,11 +42,11 @@ import static org.fusesource.hawtjni.runtime.FieldFlag.FIELD_SKIP; import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER; /** - * Provides a java interface to the C++ leveldb::Options class. + * Provides a java interface to the C++ rocksdb::Options class. * * @author Hiram Chirino */ -@JniClass(name="leveldb::Options", flags={STRUCT, CPP}) +@JniClass(name="rocksdb::Options", flags={STRUCT, CPP}) public class NativeOptions { static { @@ -57,7 +57,7 @@ public class NativeOptions { @JniMethod(flags={CONSTANT_INITIALIZER}) private static final native void init(); - @JniField(flags={CONSTANT}, cast="Env*", accessor="leveldb::Env::Default()") + @JniField(flags={CONSTANT}, cast="Env*", accessor="rocksdb::Env::Default()") private static long DEFAULT_ENV; private boolean create_if_missing = false; @@ -83,7 +83,7 @@ public class NativeOptions { @JniField(flags={FIELD_SKIP}) private NativeComparator comparatorObject = NativeComparator.BYTEWISE_COMPARATOR; - @JniField(cast="const leveldb::Comparator*") + @JniField(cast="const rocksdb::Comparator*") private long comparator = comparatorObject.pointer(); @JniField(cast="uint64_t") @@ -110,17 +110,17 @@ public class NativeOptions { @JniField(flags={FIELD_SKIP}) private NativeLogger infoLogObject = null; - @JniField(cast="leveldb::Logger*") + @JniField(cast="rocksdb::Logger*") private long info_log = 0; - @JniField(cast="leveldb::Env*") + @JniField(cast="rocksdb::Env*") private long env = DEFAULT_ENV; - @JniField(cast="leveldb::Cache*") + @JniField(cast="rocksdb::Cache*") private long block_cache = 0; @JniField(flags={FIELD_SKIP}) private NativeCache cache; - @JniField(cast="leveldb::CompressionType") + @JniField(cast="rocksdb::CompressionType") private int compression = NativeCompressionType.kSnappyCompression.value; public NativeOptions createIfMissing(boolean value) { diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeRange.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeRange.java index 953d37e78..1a08304d0 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeRange.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeRange.java @@ -41,13 +41,13 @@ import static org.fusesource.hawtjni.runtime.FieldFlag.FIELD_SKIP; import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER; /** - * Provides a java interface to the C++ leveldb::ReadOptions class. + * Provides a java interface to the C++ rocksdb::ReadOptions class. * * @author Hiram Chirino */ public class NativeRange { - @JniClass(name="leveldb::Range", flags={STRUCT, CPP}) + @JniClass(name="rocksdb::Range", flags={STRUCT, CPP}) static public class RangeJNI { static { @@ -69,7 +69,7 @@ public class NativeRange { @JniMethod(flags={CONSTANT_INITIALIZER}) private static final native void init(); - @JniField(flags={CONSTANT}, accessor="sizeof(struct leveldb::Range)") + @JniField(flags={CONSTANT}, accessor="sizeof(struct rocksdb::Range)") static int SIZEOF; @JniField diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeReadOptions.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeReadOptions.java index 85e76a3dd..3679eb2a5 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeReadOptions.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeReadOptions.java @@ -38,11 +38,11 @@ import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; /** - * Provides a java interface to the C++ leveldb::ReadOptions class. + * Provides a java interface to the C++ rocksdb::ReadOptions class. * * @author Hiram Chirino */ -@JniClass(name="leveldb::ReadOptions", flags={STRUCT, CPP}) +@JniClass(name="rocksdb::ReadOptions", flags={STRUCT, CPP}) public class NativeReadOptions { @JniField @@ -51,7 +51,7 @@ public class NativeReadOptions { @JniField private boolean fill_cache = true; - @JniField(cast="const leveldb::Snapshot*") + @JniField(cast="const rocksdb::Snapshot*") private long snapshot=0; public boolean fillCache() { diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSlice.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSlice.java index a2e2d60b5..146b4fae7 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSlice.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSlice.java @@ -41,14 +41,14 @@ import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER; import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_DELETE; /** - * Provides a java interface to the C++ leveldb::Slice class. + * Provides a java interface to the C++ rocksdb::Slice class. * * @author Hiram Chirino */ -@JniClass(name="leveldb::Slice", flags={STRUCT, CPP}) +@JniClass(name="rocksdb::Slice", flags={STRUCT, CPP}) class NativeSlice { - @JniClass(name="leveldb::Slice", flags={CPP}) + @JniClass(name="rocksdb::Slice", flags={CPP}) static class SliceJNI { static { NativeDB.LIBRARY.load(); @@ -74,7 +74,7 @@ class NativeSlice { @JniMethod(flags={CONSTANT_INITIALIZER}) private static final native void init(); - @JniField(flags={CONSTANT}, accessor="sizeof(struct leveldb::Slice)") + @JniField(flags={CONSTANT}, accessor="sizeof(struct rocksdb::Slice)") static int SIZEOF; } diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSnapshot.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSnapshot.java index 69403e198..5546c282b 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSnapshot.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeSnapshot.java @@ -32,7 +32,7 @@ package org.fusesource.leveldbjni.internal; /** - * Provides a java interface to the C++ leveldb::Snapshot class. + * Provides a java interface to the C++ rocksdb::Snapshot class. * * @author Hiram Chirino */ diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeStatus.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeStatus.java index 2950066b9..3a2605868 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeStatus.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeStatus.java @@ -39,13 +39,13 @@ import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_DELETE; import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_METHOD; /** - * Provides a java interface to the C++ leveldb::Status class. + * Provides a java interface to the C++ rocksdb::Status class. * * @author Hiram Chirino */ class NativeStatus extends NativeObject{ - @JniClass(name="leveldb::Status", flags={CPP}) + @JniClass(name="rocksdb::Status", flags={CPP}) static class StatusJNI { static { NativeDB.LIBRARY.load(); diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteBatch.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteBatch.java index bac8f21f3..b328a4e13 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteBatch.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteBatch.java @@ -41,13 +41,13 @@ import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; import static org.fusesource.hawtjni.runtime.MethodFlag.*; /** - * Provides a java interface to the C++ leveldb::WriteBatch class. + * Provides a java interface to the C++ rocksdb::WriteBatch class. * * @author Hiram Chirino */ public class NativeWriteBatch extends NativeObject { - @JniClass(name="leveldb::WriteBatch", flags={CPP}) + @JniClass(name="rocksdb::WriteBatch", flags={CPP}) private static class WriteBatchJNI { static { NativeDB.LIBRARY.load(); diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteOptions.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteOptions.java index 81c76fea1..e392d35dd 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteOptions.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/NativeWriteOptions.java @@ -38,11 +38,11 @@ import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; /** - * Provides a java interface to the C++ leveldb::WriteOptions class. + * Provides a java interface to the C++ rocksdb::WriteOptions class. * * @author Hiram Chirino */ -@JniClass(name="leveldb::WriteOptions", flags={STRUCT, CPP}) +@JniClass(name="rocksdb::WriteOptions", flags={STRUCT, CPP}) public class NativeWriteOptions { @JniField diff --git a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/Util.java b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/Util.java index 55258ad4f..f8d7c7f43 100644 --- a/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/Util.java +++ b/java/leveldbjni/leveldbjni/src/main/java/org/fusesource/leveldbjni/internal/Util.java @@ -51,14 +51,14 @@ import static org.fusesource.hawtjni.runtime.ArgFlag.*; */ public class Util { - @JniClass(name="leveldb::Env", flags={CPP}) + @JniClass(name="rocksdb::Env", flags={CPP}) static class EnvJNI { static { NativeDB.LIBRARY.load(); } - @JniMethod(cast = "leveldb::Env *", accessor = "leveldb::Env::Default") + @JniMethod(cast = "rocksdb::Env *", accessor = "rocksdb::Env::Default") public static final native long Default(); @JniMethod(flags = {CPP_METHOD}) diff --git a/java/leveldbjni/leveldbjni/src/main/native-package/src/leveldbjni.h b/java/leveldbjni/leveldbjni/src/main/native-package/src/leveldbjni.h index 977405125..7006317f8 100755 --- a/java/leveldbjni/leveldbjni/src/main/native-package/src/leveldbjni.h +++ b/java/leveldbjni/leveldbjni/src/main/native-package/src/leveldbjni.h @@ -74,12 +74,12 @@ #include "leveldb/env.h" #include "leveldb/slice.h" -struct JNIComparator : public leveldb::Comparator { +struct JNIComparator : public rocksdb::Comparator { jobject target; jmethodID compare_method; const char *name; - int Compare(const leveldb::Slice& a, const leveldb::Slice& b) const { + int Compare(const rocksdb::Slice& a, const rocksdb::Slice& b) const { JNIEnv *env; if ( hawtjni_attach_thread(&env, "leveldb") ) { return 0; @@ -93,11 +93,11 @@ struct JNIComparator : public leveldb::Comparator { return name; } - void FindShortestSeparator(std::string*, const leveldb::Slice&) const { } + void FindShortestSeparator(std::string*, const rocksdb::Slice&) const { } void FindShortSuccessor(std::string*) const { } }; -struct JNILogger : public leveldb::Logger { +struct JNILogger : public rocksdb::Logger { jobject target; jmethodID log_method; diff --git a/port/atomic_pointer.h b/port/atomic_pointer.h index c58bffbf1..9780650f1 100644 --- a/port/atomic_pointer.h +++ b/port/atomic_pointer.h @@ -38,7 +38,7 @@ #define ARCH_CPU_ARM_FAMILY 1 #endif -namespace leveldb { +namespace rocksdb { namespace port { // Define MemoryBarrier() if available @@ -147,6 +147,6 @@ class AtomicPointer { #undef ARCH_CPU_ARM_FAMILY } // namespace port -} // namespace leveldb +} // namespace rocksdb #endif // PORT_ATOMIC_POINTER_H_ diff --git a/port/port_example.h b/port/port_example.h index ab9e489b3..5979ecad9 100644 --- a/port/port_example.h +++ b/port/port_example.h @@ -10,7 +10,7 @@ #ifndef STORAGE_LEVELDB_PORT_PORT_EXAMPLE_H_ #define STORAGE_LEVELDB_PORT_PORT_EXAMPLE_H_ -namespace leveldb { +namespace rocksdb { namespace port { // TODO(jorlow): Many of these belong more in the environment class rather than @@ -130,6 +130,6 @@ extern bool Snappy_Uncompress(const char* input_data, size_t input_length, extern bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg); } // namespace port -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_PORT_PORT_EXAMPLE_H_ diff --git a/port/port_posix.cc b/port/port_posix.cc index 8e8efed44..9ecc77ebc 100644 --- a/port/port_posix.cc +++ b/port/port_posix.cc @@ -9,7 +9,7 @@ #include #include "util/logging.h" -namespace leveldb { +namespace rocksdb { namespace port { static void PthreadCall(const char* label, int result) { @@ -78,4 +78,4 @@ void InitOnce(OnceType* once, void (*initializer)()) { } } // namespace port -} // namespace leveldb +} // namespace rocksdb diff --git a/port/port_posix.h b/port/port_posix.h index 8fa0db264..0f9c51840 100644 --- a/port/port_posix.h +++ b/port/port_posix.h @@ -72,7 +72,7 @@ #define fdatasync fsync #endif -namespace leveldb { +namespace rocksdb { namespace port { static const bool kLittleEndian = PLATFORM_IS_LITTLE_ENDIAN; @@ -411,6 +411,6 @@ inline bool GetHeapProfile(void (*func)(void*, const char*, int), void* arg) { } } // namespace port -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_PORT_PORT_POSIX_H_ diff --git a/port/stack_trace.cc b/port/stack_trace.cc index 039500999..71b09d8bb 100644 --- a/port/stack_trace.cc +++ b/port/stack_trace.cc @@ -9,7 +9,7 @@ #include #include -namespace leveldb { +namespace rocksdb { static const char* GetExecutableName() { @@ -84,11 +84,11 @@ void InstallStackTraceHandler() { } -} // namespace leveldb +} // namespace rocksdb #else // no-op for non-linux system for now -namespace leveldb { +namespace rocksdb { void InstallStackTraceHandler() {} diff --git a/scribe/if/gen-cpp/scribe_types.cpp b/scribe/if/gen-cpp/scribe_types.cpp index a72d36f2f..233c3c66d 100644 --- a/scribe/if/gen-cpp/scribe_types.cpp +++ b/scribe/if/gen-cpp/scribe_types.cpp @@ -31,13 +31,13 @@ const std::map _ResultCode_NAMES_TO_VAL } // namespace namespace apache { namespace thrift { template<> -const char* TEnumTraits< ::Tleveldb::ResultCode>::findName( ::Tleveldb::ResultCode value) { -return findName( ::Tleveldb::_ResultCode_VALUES_TO_NAMES, value); +const char* TEnumTraits< ::Trocksdb::ResultCode>::findName( ::Trocksdb::ResultCode value) { +return findName( ::Trocksdb::_ResultCode_VALUES_TO_NAMES, value); } template<> -bool TEnumTraits< ::Tleveldb::ResultCode>::findValue(const char* name, ::Tleveldb::ResultCode* out) { -return findValue( ::Tleveldb::_ResultCode_NAMES_TO_VALUES, name, out); +bool TEnumTraits< ::Trocksdb::ResultCode>::findValue(const char* name, ::Trocksdb::ResultCode* out) { +return findValue( ::Trocksdb::_ResultCode_NAMES_TO_VALUES, name, out); } }} // apache::thrift diff --git a/scribe/if/gen-cpp/scribe_types.h b/scribe/if/gen-cpp/scribe_types.h index bf75a43e6..325849a1d 100644 --- a/scribe/if/gen-cpp/scribe_types.h +++ b/scribe/if/gen-cpp/scribe_types.h @@ -32,12 +32,12 @@ extern const std::map _ResultCode_NAMES } // namespace namespace apache { namespace thrift { template<> -inline constexpr ::Tleveldb::ResultCode TEnumTraits< ::Tleveldb::ResultCode>::min() { -return ::Tleveldb::ResultCode::OK; +inline constexpr ::Trocksdb::ResultCode TEnumTraits< ::Trocksdb::ResultCode>::min() { +return ::Trocksdb::ResultCode::OK; } template<> -inline constexpr ::Tleveldb::ResultCode TEnumTraits< ::Tleveldb::ResultCode>::max() { -return ::Tleveldb::ResultCode::ERROR_DECOMPRESS; +inline constexpr ::Trocksdb::ResultCode TEnumTraits< ::Trocksdb::ResultCode>::max() { +return ::Trocksdb::ResultCode::ERROR_DECOMPRESS; } }} // apache:thrift diff --git a/scribe/scribe_logger.cc b/scribe/scribe_logger.cc index e39f7f4b4..6b65262cd 100644 --- a/scribe/scribe_logger.cc +++ b/scribe/scribe_logger.cc @@ -1,6 +1,6 @@ #include "scribe_logger.h" -namespace leveldb { +namespace rocksdb { const std::string ScribeLogger::COL_SEPERATOR = "\x1"; const std::string ScribeLogger::DEPLOY_STATS_CATEGORY = "leveldb_deploy_stats"; diff --git a/scribe/scribe_logger.h b/scribe/scribe_logger.h index bd986eeb7..965a7267e 100644 --- a/scribe/scribe_logger.h +++ b/scribe/scribe_logger.h @@ -15,7 +15,7 @@ #include "boost/lexical_cast.hpp" using namespace Tleveldb; -using Tleveldb::scribeClient; +using Trocksdb::scribeClient; using namespace apache::thrift; using namespace apache::thrift::protocol; @@ -25,7 +25,7 @@ using boost::shared_ptr; using namespace ::Tleveldb; -namespace leveldb { +namespace rocksdb { class ScribeLogger : public StatsLogger{ private: diff --git a/table/block.cc b/table/block.cc index bbb8d809b..1673d3ff5 100644 --- a/table/block.cc +++ b/table/block.cc @@ -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 diff --git a/table/block.h b/table/block.h index 8bd26521b..20b4c4511 100644 --- a/table/block.h +++ b/table/block.h @@ -9,7 +9,7 @@ #include #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_ diff --git a/table/block_builder.cc b/table/block_builder.cc index e3a738ee5..96857c51a 100644 --- a/table/block_builder.cc +++ b/table/block_builder.cc @@ -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 diff --git a/table/block_builder.h b/table/block_builder.h index af8ff4f69..c635e2d3e 100644 --- a/table/block_builder.h +++ b/table/block_builder.h @@ -10,7 +10,7 @@ #include #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_ diff --git a/table/block_test.cc b/table/block_test.cc index 1d0dddfea..5b9e052bb 100644 --- a/table/block_test.cc +++ b/table/block_test.cc @@ -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(); } diff --git a/table/filter_block.cc b/table/filter_block.cc index 4d52766e5..758040ecb 100644 --- a/table/filter_block.cc +++ b/table/filter_block.cc @@ -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. diff --git a/table/filter_block.h b/table/filter_block.h index e5f4e5e6b..c477fb3a9 100644 --- a/table/filter_block.h +++ b/table/filter_block.h @@ -18,7 +18,7 @@ #include "rocksdb/slice_transform.h" #include "util/hash.h" -namespace leveldb { +namespace rocksdb { class FilterPolicy; diff --git a/table/filter_block_test.cc b/table/filter_block_test.cc index aa877becf..faa0fe146 100644 --- a/table/filter_block_test.cc +++ b/table/filter_block_test.cc @@ -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(); } diff --git a/table/format.cc b/table/format.cc index 60467297f..ecfbf00d0 100644 --- a/table/format.cc +++ b/table/format.cc @@ -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 diff --git a/table/format.h b/table/format.h index 31fa4f6b6..23a668002 100644 --- a/table/format.h +++ b/table/format.h @@ -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(0)) { } -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_TABLE_FORMAT_H_ diff --git a/table/iter_heap.h b/table/iter_heap.h index ac46d4dfe..3dce5dd55 100644 --- a/table/iter_heap.h +++ b/table/iter_heap.h @@ -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_ diff --git a/table/iterator.cc b/table/iterator.cc index bff98e569..52151e7b5 100644 --- a/table/iterator.cc +++ b/table/iterator.cc @@ -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 diff --git a/table/iterator_wrapper.h b/table/iterator_wrapper.h index 98d852466..a0214e58a 100644 --- a/table/iterator_wrapper.h +++ b/table/iterator_wrapper.h @@ -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_ diff --git a/table/merger.cc b/table/merger.cc index 71cae45d4..c768b261e 100644 --- a/table/merger.cc +++ b/table/merger.cc @@ -11,7 +11,7 @@ #include -namespace leveldb { +namespace rocksdb { namespace { @@ -220,4 +220,4 @@ Iterator* NewMergingIterator(const Comparator* cmp, Iterator** list, int n) { } } -} // namespace leveldb +} // namespace rocksdb diff --git a/table/merger.h b/table/merger.h index 91ddd80fa..27b81dbe7 100644 --- a/table/merger.h +++ b/table/merger.h @@ -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_ diff --git a/table/table.cc b/table/table.cc index 6b59b3ce3..f3c17b6a2 100644 --- a/table/table.cc +++ b/table/table.cc @@ -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 diff --git a/table/table.h b/table/table.h index 52d618f38..6007d441f 100644 --- a/table/table.h +++ b/table/table.h @@ -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_ diff --git a/table/table_builder.cc b/table/table_builder.cc index be779af38..dd51332dd 100644 --- a/table/table_builder.cc +++ b/table/table_builder.cc @@ -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 diff --git a/table/table_test.cc b/table/table_test.cc index 268c9555a..92093e498 100644 --- a/table/table_test.cc +++ b/table/table_test.cc @@ -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(); } diff --git a/table/two_level_iterator.cc b/table/two_level_iterator.cc index 8af7f18ed..fe02662be 100644 --- a/table/two_level_iterator.cc +++ b/table/two_level_iterator.cc @@ -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 diff --git a/table/two_level_iterator.h b/table/two_level_iterator.h index a398254b8..ebe287801 100644 --- a/table/two_level_iterator.h +++ b/table/two_level_iterator.h @@ -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_ diff --git a/thrift/assoc.h b/thrift/assoc.h index af944bd10..150912899 100644 --- a/thrift/assoc.h +++ b/thrift/assoc.h @@ -46,7 +46,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { int64_t timestamp, AssocVisibility visibility, bool update_count, int64_t dataVersion, const Text& data, const Text& wormhole_comment) { - leveldb::DB* db = openhandles_->get(tableName, NULL); + rocksdb::DB* db = openhandles_->get(tableName, NULL); if (db == NULL) { return Code::kNotFound; } @@ -60,7 +60,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { int64_t taoAssocDelete(const Text& tableName, int64_t assocType, int64_t id1, int64_t id2, AssocVisibility visibility, bool update_count, const Text& wormhole_comment) { - leveldb::DB* db = openhandles_->get(tableName, NULL); + rocksdb::DB* db = openhandles_->get(tableName, NULL); if (db == NULL) { return Code::kNotFound; } @@ -73,11 +73,11 @@ class AssocServiceHandler : virtual public AssocServiceIf { const Text& tableName, int64_t assocType, int64_t id1, int64_t start_time, int64_t end_time, int64_t offset, int64_t limit) { - leveldb::DB* db = openhandles_->get(tableName, NULL); + rocksdb::DB* db = openhandles_->get(tableName, NULL); if (db == NULL) { throw generate_exception(tableName, Code::kNotFound, "taoAssocRangeGet: Unable to open database " , - assocType, id1, 0, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); } assocRangeGetBytimeInternal(_return, tableName, db, assocType, id1, start_time, end_time, offset, limit); @@ -86,17 +86,17 @@ class AssocServiceHandler : virtual public AssocServiceIf { void taoAssocGet(std::vector & _return, const Text& tableName, int64_t assocType, int64_t id1, const std::vector & id2s) { - leveldb::DB* db = openhandles_->get(tableName, NULL); + rocksdb::DB* db = openhandles_->get(tableName, NULL); if (db == NULL) { throw generate_exception(tableName, Code::kNotFound, "taoAssocGet:Unable to open database " , - assocType, id1, 0, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); } assocGetInternal(_return, tableName, db, assocType, id1, id2s); } int64_t taoAssocCount(const Text& tableName, int64_t assocType, int64_t id1) { - leveldb::DB* db = openhandles_->get(tableName, NULL); + rocksdb::DB* db = openhandles_->get(tableName, NULL); if (db == NULL) { return Code::kNotFound; } @@ -105,9 +105,9 @@ class AssocServiceHandler : virtual public AssocServiceIf { private: OpenHandles* openhandles_; - leveldb::ReadOptions roptions_; - leveldb::WriteOptions woptions_; // write with no sync - leveldb::WriteOptions woptions_sync_; // write with sync + rocksdb::ReadOptions roptions_; + rocksdb::WriteOptions woptions_; // write with no sync + rocksdb::WriteOptions woptions_sync_; // write with sync // the maximum values returned in a rangeget/multiget call. const static unsigned int MAX_RANGE_SIZE = 10000; @@ -117,10 +117,10 @@ class AssocServiceHandler : virtual public AssocServiceIf { // A bunch of rowlocks, sharded over the entire rowkey range // Each rowkey is deterministically mapped to one of these locks. - leveldb::port::RWMutex rowlocks_[1000]; + rocksdb::port::RWMutex rowlocks_[1000]; // A helper method that hashes the row key to a lock - leveldb::port::RWMutex* findRowLock(char* str, int size) { + rocksdb::port::RWMutex* findRowLock(char* str, int size) { int index = MurmurHash(str, size, HASHSEED) % sizeof(rowlocks_); return &rowlocks_[index]; } @@ -131,13 +131,13 @@ class AssocServiceHandler : virtual public AssocServiceIf { // If !update_count, return zero. // On failure, throws exception // - int64_t assocPutInternal(const Text& tableName, leveldb::DB* db, + int64_t assocPutInternal(const Text& tableName, rocksdb::DB* db, int64_t assocType, int64_t id1, int64_t id2, int64_t id1Type, int64_t id2Type, int64_t ts, AssocVisibility vis, bool update_count, int64_t dataVersion, const Text& data, const Text& wormhole_comment) { - leveldb::WriteBatch batch; + rocksdb::WriteBatch batch; ts = convertTime(ts); // change time to numberofmillis till MAXLONG // create the payload for this assoc @@ -155,7 +155,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { int64_t oldts; int8_t oldvis; bool newassoc = false; // is this assoc new or an overwrite - leveldb::Status status; + rocksdb::Status status; std::string value; // create RowKey for 'c' @@ -166,13 +166,13 @@ class AssocServiceHandler : virtual public AssocServiceIf { char* keybuf = &dummy1[0]; int rowkeysize = makeRowKey(keybuf, id1, assocType); int keysize = appendRowKeyForCount(rowkeysize, keybuf); - leveldb::Slice ckey(keybuf, keysize); + rocksdb::Slice ckey(keybuf, keysize); // find the row lock - leveldb::port::RWMutex* rowlock = findRowLock(keybuf, rowkeysize); + rocksdb::port::RWMutex* rowlock = findRowLock(keybuf, rowkeysize); { // acquire the row lock - leveldb::WriteLock l(rowlock); + rocksdb::WriteLock l(rowlock); // Scan 'c' to get $count if $update_count == true if (update_count) { @@ -196,7 +196,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { keybuf = &dummy2[0]; rowkeysize = makeRowKey(keybuf, id1, assocType); keysize = appendRowKeyForMeta(rowkeysize, keybuf, id2); - leveldb::Slice mkey(keybuf, keysize); + rocksdb::Slice mkey(keybuf, keysize); status = db->Get(roptions_, mkey, &value); if (status.IsNotFound()) { newassoc = true; @@ -221,7 +221,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { if (!newassoc) { extractTsVisString(&oldts, &oldvis, (char *)value.c_str()); keysize = appendRowKeyForPayload(rowkeysize, keybuf, oldts, id2); - leveldb::Slice pkey(keybuf, keysize); + rocksdb::Slice pkey(keybuf, keysize); if (ts != oldts) { batch.Delete(pkey); } @@ -232,14 +232,14 @@ class AssocServiceHandler : virtual public AssocServiceIf { myvalue.reserve(sizeof(int64_t) + sizeof(int8_t)); myvalue.resize(sizeof(int64_t) + sizeof(int8_t)); makeTsVisString(&myvalue[0], ts, vis); - leveldb::Slice sl(myvalue); - batch.Put(mkey, leveldb::Slice(myvalue)); + rocksdb::Slice sl(myvalue); + batch.Put(mkey, rocksdb::Slice(myvalue)); // store in p$ts$id2 the payload keybuf = &dummy3[0]; keysize = appendRowKeyForPayload(rowkeysize, keybuf, ts, id2); - leveldb::Slice pkeynew(keybuf, keysize); - batch.Put(pkeynew, leveldb::Slice(payload)); + rocksdb::Slice pkeynew(keybuf, keysize); + batch.Put(pkeynew, rocksdb::Slice(payload)); // increment count if (update_count && (newassoc || oldvis != VISIBLE)) { @@ -248,7 +248,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { myvalue.reserve(sizeof(int64_t)); myvalue.resize(sizeof(int64_t)); makeCountString(&myvalue[0], count); - batch.Put(ckey, leveldb::Slice(myvalue)); + batch.Put(ckey, rocksdb::Slice(myvalue)); } // We do a write here without sync. This writes it to the @@ -285,11 +285,11 @@ class AssocServiceHandler : virtual public AssocServiceIf { // If count changes return 1, else returns zero // On failure, thrws exception // - int64_t assocDeleteInternal(const Text& tableName, leveldb::DB* db, + int64_t assocDeleteInternal(const Text& tableName, rocksdb::DB* db, int64_t assocType, int64_t id1, int64_t id2, AssocVisibility vis, bool update_count, const Text& wormhole_comment) { - leveldb::WriteBatch batch; + rocksdb::WriteBatch batch; int return_value = 0; int64_t count = 0; int64_t oldts; @@ -303,15 +303,15 @@ class AssocServiceHandler : virtual public AssocServiceIf { dummy.resize(maxkeysize); char* keybuf = &dummy[0]; int rowkeysize = makeRowKey(keybuf, id1, assocType); - leveldb::Status status; + rocksdb::Status status; int keysize = appendRowKeyForCount(rowkeysize, keybuf); - leveldb::Slice ckey(keybuf, keysize); + rocksdb::Slice ckey(keybuf, keysize); // find the row lock - leveldb::port::RWMutex* rowlock = findRowLock(keybuf, rowkeysize); + rocksdb::port::RWMutex* rowlock = findRowLock(keybuf, rowkeysize); { // acquire the row lock - leveldb::WriteLock l(rowlock); + rocksdb::WriteLock l(rowlock); // Scan 'c' to get $count if $update_count == true if (update_count) { @@ -337,7 +337,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { keybuf = &dummy2[0]; rowkeysize = makeRowKey(keybuf, id1, assocType); keysize = appendRowKeyForMeta(rowkeysize, keybuf, id2); - leveldb::Slice mkey(keybuf, keysize); + rocksdb::Slice mkey(keybuf, keysize); status = db->Get(roptions_, mkey, &value); if (status.IsNotFound()) { throw generate_exception(tableName, Code::kNotFound, @@ -359,7 +359,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { keybuf = &dummy3[0]; rowkeysize = makeRowKey(keybuf, id1, assocType); keysize = appendRowKeyForDelete(rowkeysize, keybuf, id2); - leveldb::Slice dkey(keybuf, keysize); + rocksdb::Slice dkey(keybuf, keysize); // create key for 'p' maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + @@ -370,7 +370,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { keybuf = &dummy4[0]; rowkeysize = makeRowKey(keybuf, id1, assocType); keysize = appendRowKeyForPayload(rowkeysize, keybuf, oldts, id2); - leveldb::Slice pkey(keybuf, keysize); + rocksdb::Slice pkey(keybuf, keysize); // if this is a hard delete, then delete all columns if (vis == AssocVisibility::HARD_DELETE) { @@ -385,7 +385,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { mvalue.reserve(sizeof(int64_t) + sizeof(int8_t)); mvalue.resize(sizeof(int64_t) + sizeof(int8_t)); makeTsVisString(&mvalue[0], oldts, vis); - batch.Put(mkey, leveldb::Slice(mvalue)); + batch.Put(mkey, rocksdb::Slice(mvalue)); } // scan p$tsid2 to get payload @@ -404,7 +404,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { } // store payload in d$id2 - batch.Put(dkey, leveldb::Slice(pvalue)); + batch.Put(dkey, rocksdb::Slice(pvalue)); // delete p$ts$id2 batch.Delete(pkey); @@ -417,7 +417,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { myvalue.reserve(sizeof(int64_t)); myvalue.resize(sizeof(int64_t)); makeCountString(&myvalue[0], count); - batch.Put(ckey, leveldb::Slice(myvalue)); + batch.Put(ckey, rocksdb::Slice(myvalue)); } status = db->Write(woptions_, &batch); // write with no sync if (!status.ok()) { @@ -443,7 +443,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { return return_value; } - int64_t assocCountInternal(const Text& tableName, leveldb::DB* db, + int64_t assocCountInternal(const Text& tableName, rocksdb::DB* db, int64_t assocType, int64_t id1) { // create key to query int maxkeysize = sizeof(id1) + sizeof(assocType) + 1; @@ -453,10 +453,10 @@ class AssocServiceHandler : virtual public AssocServiceIf { char* keybuf = &dummy[0]; int rowkeysize = makeRowKey(keybuf, id1, assocType); int keysize = appendRowKeyForCount(rowkeysize, keybuf); // column 'c' - leveldb::Slice ckey(keybuf, keysize); + rocksdb::Slice ckey(keybuf, keysize); // Query database to find value - leveldb::Status status; + rocksdb::Status status; std::string value; int64_t count; status = db->Get(roptions_, ckey, &value); @@ -467,27 +467,27 @@ class AssocServiceHandler : virtual public AssocServiceIf { } else if (!status.ok()) { throw generate_exception(tableName, Code::kNotFound, "assocCountInternal Unable to find count ", - assocType, id1, 0, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); } if (value.size() != sizeof(int64_t)) { printf("expected %ld got %ld\n", sizeof(int64_t), value.size()); throw generate_exception(tableName, Code::kNotFound, "assocCountInternal Bad sizes for count ", - assocType, id1, 0, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); } extract_int64(&count, (char *)value.c_str()); return count; } void assocRangeGetBytimeInternal(std::vector & _return, - const Text& tableName, leveldb::DB* db, + const Text& tableName, rocksdb::DB* db, int64_t assocType, int64_t id1, int64_t start_time, int64_t end_time, int64_t offset, int64_t limit) { if (start_time < end_time) { throw generate_exception(tableName, Code::kNotFound, "assocRangeGetBytimeInternal:Bad starttime and endtime\n", - assocType, id1, 0, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); } int64_t ts, id2; @@ -511,8 +511,8 @@ class AssocServiceHandler : virtual public AssocServiceIf { // Position scan at 'p'$ts$id2 where ts = startTime and id2 = 0 id2 = 0; int keysize = appendRowKeyForPayload(rowkeysize, keybuf, startTime, id2); - leveldb::Slice pkey(keybuf, keysize); - leveldb::Iterator* iter = db->NewIterator(roptions_); + rocksdb::Slice pkey(keybuf, keysize); + rocksdb::Iterator* iter = db->NewIterator(roptions_); for (iter->Seek(pkey); iter->Valid() && limit > 0 ; iter->Next()) { // skip over records that the caller is not interested in @@ -545,7 +545,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { void assocGetInternal(std::vector & _return, const Text& tableName, - leveldb::DB* db, + rocksdb::DB* db, int64_t assocType, int64_t id1, const std::vector & id2s) { int64_t ts, id2; @@ -553,7 +553,7 @@ class AssocServiceHandler : virtual public AssocServiceIf { if (id2s.size() > MAX_RANGE_SIZE) { throw generate_exception(tableName, Code::kNotFound, "assocGetInternal Ids2 cannot be gteater than 10K.", - assocType, id1, 0, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); } // allocate the entire result buffer. _return.reserve(id2s.size()); @@ -568,32 +568,32 @@ class AssocServiceHandler : virtual public AssocServiceIf { // create rowkey char* keybuf = &dummy[0]; int rowkeysize = makeRowKey(keybuf, id1, assocType); - leveldb::Iterator* iter = db->NewIterator(roptions_); + rocksdb::Iterator* iter = db->NewIterator(roptions_); for (unsigned int index = 0; index < id2s.size(); index++) { int64_t ts; int8_t oldvis; - leveldb::Status status; + rocksdb::Status status; std::string wormhole; // query column 'm'$id2 id2 = id2s[index]; int keysize = appendRowKeyForMeta(rowkeysize, keybuf, id2); - leveldb::Slice ckey(keybuf, keysize); + rocksdb::Slice ckey(keybuf, keysize); iter->Seek(ckey); if (!iter->Valid()) { throw generate_exception(tableName, Code::kNotFound, "Unable to find m$id2 ", - assocType, id1, id2, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, id2, 0, 0, 0, Trocksdb::UNUSED1); } if (ckey != iter->key()) { continue; // non existant assoc } - leveldb::Slice value = iter->value(); + rocksdb::Slice value = iter->value(); if (value.size() != sizeof(int64_t) + sizeof(int8_t)) { throw generate_exception(tableName, Code::kNotFound, "Unable to find m$id2 ", - assocType, id1, id2, 0, 0, 0, Tleveldb::UNUSED1); + assocType, id1, id2, 0, 0, 0, Trocksdb::UNUSED1); } extractTsVisString(&ts, &oldvis, (char*)value.data_); @@ -604,12 +604,12 @@ class AssocServiceHandler : virtual public AssocServiceIf { // this assoc is visible, scan 'p'$ts$id2 to retrieve payload. keysize = appendRowKeyForPayload(rowkeysize, keybuf, ts, id2); - leveldb::Slice pkey(keybuf, keysize); + rocksdb::Slice pkey(keybuf, keysize); iter->Seek(pkey); if (!iter->Valid() || (pkey != iter->key())) { throw generate_exception(tableName, Code::kNotFound, "Unable to find p$ts$id2 ", - assocType, id1, id2, 0, 0, ts, Tleveldb::UNUSED1); + assocType, id1, id2, 0, 0, ts, Trocksdb::UNUSED1); } // allocate a new slot in the result set. diff --git a/thrift/gen-cpp/leveldb_types.cpp b/thrift/gen-cpp/leveldb_types.cpp index 4654ee213..7c9347de8 100644 --- a/thrift/gen-cpp/leveldb_types.cpp +++ b/thrift/gen-cpp/leveldb_types.cpp @@ -29,13 +29,13 @@ const std::map _CompressionType_NAMES_T } // namespace namespace apache { namespace thrift { template<> -const char* TEnumTraits< ::Tleveldb::CompressionType>::findName( ::Tleveldb::CompressionType value) { -return findName( ::Tleveldb::_CompressionType_VALUES_TO_NAMES, value); +const char* TEnumTraits< ::Trocksdb::CompressionType>::findName( ::Trocksdb::CompressionType value) { +return findName( ::Trocksdb::_CompressionType_VALUES_TO_NAMES, value); } template<> -bool TEnumTraits< ::Tleveldb::CompressionType>::findValue(const char* name, ::Tleveldb::CompressionType* out) { -return findValue( ::Tleveldb::_CompressionType_NAMES_TO_VALUES, name, out); +bool TEnumTraits< ::Trocksdb::CompressionType>::findValue(const char* name, ::Trocksdb::CompressionType* out) { +return findValue( ::Trocksdb::_CompressionType_NAMES_TO_VALUES, name, out); } }} // apache::thrift @@ -67,13 +67,13 @@ const std::map _Code_NAMES_TO_VALUES(ap } // namespace namespace apache { namespace thrift { template<> -const char* TEnumTraits< ::Tleveldb::Code>::findName( ::Tleveldb::Code value) { -return findName( ::Tleveldb::_Code_VALUES_TO_NAMES, value); +const char* TEnumTraits< ::Trocksdb::Code>::findName( ::Trocksdb::Code value) { +return findName( ::Trocksdb::_Code_VALUES_TO_NAMES, value); } template<> -bool TEnumTraits< ::Tleveldb::Code>::findValue(const char* name, ::Tleveldb::Code* out) { -return findValue( ::Tleveldb::_Code_NAMES_TO_VALUES, name, out); +bool TEnumTraits< ::Trocksdb::Code>::findValue(const char* name, ::Trocksdb::Code* out) { +return findValue( ::Trocksdb::_Code_NAMES_TO_VALUES, name, out); } }} // apache::thrift @@ -97,13 +97,13 @@ const std::map _IteratorType_NAMES_TO_V } // namespace namespace apache { namespace thrift { template<> -const char* TEnumTraits< ::Tleveldb::IteratorType>::findName( ::Tleveldb::IteratorType value) { -return findName( ::Tleveldb::_IteratorType_VALUES_TO_NAMES, value); +const char* TEnumTraits< ::Trocksdb::IteratorType>::findName( ::Trocksdb::IteratorType value) { +return findName( ::Trocksdb::_IteratorType_VALUES_TO_NAMES, value); } template<> -bool TEnumTraits< ::Tleveldb::IteratorType>::findValue(const char* name, ::Tleveldb::IteratorType* out) { -return findValue( ::Tleveldb::_IteratorType_NAMES_TO_VALUES, name, out); +bool TEnumTraits< ::Trocksdb::IteratorType>::findValue(const char* name, ::Trocksdb::IteratorType* out) { +return findValue( ::Trocksdb::_IteratorType_NAMES_TO_VALUES, name, out); } }} // apache::thrift @@ -133,13 +133,13 @@ const std::map _AssocVisibility_NAMES_T } // namespace namespace apache { namespace thrift { template<> -const char* TEnumTraits< ::Tleveldb::AssocVisibility>::findName( ::Tleveldb::AssocVisibility value) { -return findName( ::Tleveldb::_AssocVisibility_VALUES_TO_NAMES, value); +const char* TEnumTraits< ::Trocksdb::AssocVisibility>::findName( ::Trocksdb::AssocVisibility value) { +return findName( ::Trocksdb::_AssocVisibility_VALUES_TO_NAMES, value); } template<> -bool TEnumTraits< ::Tleveldb::AssocVisibility>::findValue(const char* name, ::Tleveldb::AssocVisibility* out) { -return findValue( ::Tleveldb::_AssocVisibility_NAMES_TO_VALUES, name, out); +bool TEnumTraits< ::Trocksdb::AssocVisibility>::findValue(const char* name, ::Trocksdb::AssocVisibility* out) { +return findValue( ::Trocksdb::_AssocVisibility_NAMES_TO_VALUES, name, out); } }} // apache::thrift diff --git a/thrift/gen-cpp/leveldb_types.h b/thrift/gen-cpp/leveldb_types.h index 117ed4f71..f5e92e714 100644 --- a/thrift/gen-cpp/leveldb_types.h +++ b/thrift/gen-cpp/leveldb_types.h @@ -31,12 +31,12 @@ extern const std::map _CompressionType_ } // namespace namespace apache { namespace thrift { template<> -inline constexpr ::Tleveldb::CompressionType TEnumTraits< ::Tleveldb::CompressionType>::min() { -return ::Tleveldb::CompressionType::kNoCompression; +inline constexpr ::Trocksdb::CompressionType TEnumTraits< ::Trocksdb::CompressionType>::min() { +return ::Trocksdb::CompressionType::kNoCompression; } template<> -inline constexpr ::Tleveldb::CompressionType TEnumTraits< ::Tleveldb::CompressionType>::max() { -return ::Tleveldb::CompressionType::kSnappyCompression; +inline constexpr ::Trocksdb::CompressionType TEnumTraits< ::Trocksdb::CompressionType>::max() { +return ::Trocksdb::CompressionType::kSnappyCompression; } }} // apache:thrift @@ -58,12 +58,12 @@ extern const std::map _Code_NAMES_TO_VA } // namespace namespace apache { namespace thrift { template<> -inline constexpr ::Tleveldb::Code TEnumTraits< ::Tleveldb::Code>::min() { -return ::Tleveldb::Code::kOk; +inline constexpr ::Trocksdb::Code TEnumTraits< ::Trocksdb::Code>::min() { +return ::Trocksdb::Code::kOk; } template<> -inline constexpr ::Tleveldb::Code TEnumTraits< ::Tleveldb::Code>::max() { -return ::Tleveldb::Code::kEnd; +inline constexpr ::Trocksdb::Code TEnumTraits< ::Trocksdb::Code>::max() { +return ::Trocksdb::Code::kEnd; } }} // apache:thrift @@ -81,12 +81,12 @@ extern const std::map _IteratorType_NAM } // namespace namespace apache { namespace thrift { template<> -inline constexpr ::Tleveldb::IteratorType TEnumTraits< ::Tleveldb::IteratorType>::min() { -return ::Tleveldb::IteratorType::seekToFirst; +inline constexpr ::Trocksdb::IteratorType TEnumTraits< ::Trocksdb::IteratorType>::min() { +return ::Trocksdb::IteratorType::seekToFirst; } template<> -inline constexpr ::Tleveldb::IteratorType TEnumTraits< ::Tleveldb::IteratorType>::max() { -return ::Tleveldb::IteratorType::seekToKey; +inline constexpr ::Trocksdb::IteratorType TEnumTraits< ::Trocksdb::IteratorType>::max() { +return ::Trocksdb::IteratorType::seekToKey; } }} // apache:thrift @@ -107,12 +107,12 @@ extern const std::map _AssocVisibility_ } // namespace namespace apache { namespace thrift { template<> -inline constexpr ::Tleveldb::AssocVisibility TEnumTraits< ::Tleveldb::AssocVisibility>::min() { -return ::Tleveldb::AssocVisibility::VISIBLE; +inline constexpr ::Trocksdb::AssocVisibility TEnumTraits< ::Trocksdb::AssocVisibility>::min() { +return ::Trocksdb::AssocVisibility::VISIBLE; } template<> -inline constexpr ::Tleveldb::AssocVisibility TEnumTraits< ::Tleveldb::AssocVisibility>::max() { -return ::Tleveldb::AssocVisibility::HARD_DELETE; +inline constexpr ::Trocksdb::AssocVisibility TEnumTraits< ::Trocksdb::AssocVisibility>::max() { +return ::Trocksdb::AssocVisibility::HARD_DELETE; } }} // apache:thrift diff --git a/thrift/openhandles.h b/thrift/openhandles.h index a406eca0b..45583617d 100644 --- a/thrift/openhandles.h +++ b/thrift/openhandles.h @@ -27,7 +27,7 @@ using namespace ::Tleveldb; // List of snapshots. Each entry has a unique snapshot id. struct snapshotEntry { int64_t snapshotid; - const leveldb::Snapshot* lsnap; + const rocksdb::Snapshot* lsnap; snapshotEntry() : snapshotid(-1), lsnap(NULL) { } @@ -40,7 +40,7 @@ struct snapshotEntry { // List of iterators. Each entry has a unique iterator id. struct iteratorEntry { int64_t iteratorid; - leveldb::Iterator* liter; + rocksdb::Iterator* liter; iteratorEntry() : iteratorid(-1), liter(NULL) { } @@ -58,7 +58,7 @@ struct iteratorEntry { // struct onehandle { Text name; - leveldb::DB* onedb; // locate the localleveldb instance + rocksdb::DB* onedb; // locate the localleveldb instance int refcount; // currently not used std::atomic currentSnapshotId; // valid snapshotids > 0 std::atomic currentIteratorId; // valid iterators > 0 @@ -72,7 +72,7 @@ struct onehandle { } // stores a new leveldb snapshot and returns an unique id - int64_t addSnapshot(const leveldb::Snapshot* l) { + int64_t addSnapshot(const rocksdb::Snapshot* l) { struct snapshotEntry* news = new snapshotEntry; news->snapshotid = currentSnapshotId++; news->lsnap = l; @@ -81,7 +81,7 @@ struct onehandle { } // lookup a snapshot from its ids - const leveldb::Snapshot* lookupSnapshot(int64_t id) { + const rocksdb::Snapshot* lookupSnapshot(int64_t id) { auto p = snaplist.find(id); if (p == snaplist.end()) { fprintf(stderr, "get:No snaphot with id %ld\n", id); @@ -91,8 +91,8 @@ struct onehandle { } // remove a snapshot from this database - const leveldb::Snapshot* removeSnapshot(int64_t id) { - const leveldb::Snapshot* l = lookupSnapshot(id); + const rocksdb::Snapshot* removeSnapshot(int64_t id) { + const rocksdb::Snapshot* l = lookupSnapshot(id); if (l != NULL) { int numRemoved = snaplist.erase(id); assert(numRemoved == 1); @@ -102,7 +102,7 @@ struct onehandle { } // stores a new leveldb iterator and returns an unique id - int64_t addIterator(leveldb::Iterator* l) { + int64_t addIterator(rocksdb::Iterator* l) { struct iteratorEntry* news = new iteratorEntry; news->iteratorid = currentIteratorId++; news->liter = l; @@ -111,7 +111,7 @@ struct onehandle { } // lookup a iterator from its ids - leveldb::Iterator* lookupIterator(int64_t id) { + rocksdb::Iterator* lookupIterator(int64_t id) { auto p = iterlist.find(id); if (p == iterlist.end()) { fprintf(stderr, "lookupIterator:No iterator with id %ld\n", id); @@ -121,8 +121,8 @@ struct onehandle { } // remove a iterator from this database - leveldb::Iterator* removeIterator(int64_t id) { - leveldb::Iterator* i = lookupIterator(id); + rocksdb::Iterator* removeIterator(int64_t id) { + rocksdb::Iterator* i = lookupIterator(id); if (i != NULL) { int numRemoved = iterlist.erase(id); assert(numRemoved == 1); @@ -145,14 +145,14 @@ class OpenHandles { // Inserts a new database into the list. // If the database is already open, increase refcount. // If the database is not already open, open and insert into list. - void add(leveldb::Options& options, Text dbname, std::string dbdir) { + void add(rocksdb::Options& options, Text dbname, std::string dbdir) { struct onehandle* found = head_[dbname]; if (found == NULL) { found = new onehandle; found->name = dbname; fprintf(stderr, "openhandle.add: Opening leveldb DB %s\n", dbname.c_str()); - leveldb::Status status = leveldb::DB::Open(options, dbdir, &found->onedb); + rocksdb::Status status = rocksdb::DB::Open(options, dbdir, &found->onedb); if (!status.ok()) { LeveldbException e; e.errorCode = Code::kIOError; @@ -167,7 +167,7 @@ class OpenHandles { found->refcount++; } - leveldb::DB* get(Text dbname, struct onehandle** f) { + rocksdb::DB* get(Text dbname, struct onehandle** f) { auto p = head_.find(dbname); if (p == head_.end()) { fprintf(stderr, "get:No db with name\n"); diff --git a/thrift/server_options.h b/thrift/server_options.h index 797c9a566..de604fe0e 100644 --- a/thrift/server_options.h +++ b/thrift/server_options.h @@ -24,7 +24,7 @@ class ServerOptions { int port_; // port number std::string hostname_; // host name of this machine std::string rootdir_; // root directory of all DBs - leveldb::Cache* cache_; // the block cache + rocksdb::Cache* cache_; // the block cache // Number of concurrent threads to run. const static int DEFAULT_threads = 1; @@ -110,9 +110,9 @@ public: // create a cache instance that is shared by all DBs served by this server void createCache() { if (cache_numshardbits_ >= 1) { - cache_ = leveldb::NewLRUCache(cache_size_, cache_numshardbits_); + cache_ = rocksdb::NewLRUCache(cache_size_, cache_numshardbits_); } else { - cache_ = leveldb::NewLRUCache(cache_size_); + cache_ = rocksdb::NewLRUCache(cache_size_); } } @@ -129,7 +129,7 @@ public: } // Returns the cache - leveldb::Cache* getCache() { + rocksdb::Cache* getCache() { return cache_; } diff --git a/thrift/server_utils.cpp b/thrift/server_utils.cpp index 120737f8b..dea566b4d 100644 --- a/thrift/server_utils.cpp +++ b/thrift/server_utils.cpp @@ -58,7 +58,7 @@ class DBHandler : virtual public DBIf { throw e; } std::string dbdir = server_options.getDataDirectory(dbname); - leveldb::Options options; + rocksdb::Options options; // fill up per-server options options.block_cache = server_options.getCache(); @@ -71,9 +71,9 @@ class DBHandler : virtual public DBIf { options.block_size = dboptions.block_size; options.block_restart_interval = dboptions.block_restart_interval; if (dboptions.compression == kNoCompression) { - options.compression = leveldb::kNoCompression; + options.compression = rocksdb::kNoCompression; } else if (dboptions.compression == kSnappyCompression) { - options.compression = leveldb::kSnappyCompression; + options.compression = rocksdb::kSnappyCompression; } if (dboptions.num_levels > 0) options.num_levels = dboptions.num_levels; @@ -109,19 +109,19 @@ class DBHandler : virtual public DBIf { Code Put(const DBHandle& dbhandle, const kv& kv, const WriteOptions& options) { - leveldb::WriteOptions woptions; + rocksdb::WriteOptions woptions; woptions.sync = options.sync; woptions.disableWAL = options.disableWAL; - leveldb::Slice key, value; + rocksdb::Slice key, value; key.data_ = kv.key.data.data(); key.size_ = kv.key.size; value.data_ = kv.value.data.data(); value.size_ = kv.value.size; - leveldb::DB* db = openHandles->get(dbhandle.dbname, NULL); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, NULL); if (db == NULL) { return Code::kNotFound; } - leveldb::Status status = db->Put(woptions, key, value); + rocksdb::Status status = db->Put(woptions, key, value); if (status.ok()) { return Code::kOk; } @@ -130,17 +130,17 @@ class DBHandler : virtual public DBIf { Code Delete(const DBHandle& dbhandle, const Slice& kv, const WriteOptions& options) { - leveldb::WriteOptions woptions; + rocksdb::WriteOptions woptions; woptions.sync = options.sync; woptions.disableWAL = options.disableWAL; - leveldb::Slice key; + rocksdb::Slice key; key.data_ = kv.data.data(); key.size_ = kv.size; - leveldb::DB* db = openHandles->get(dbhandle.dbname, NULL); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, NULL); if (db == NULL) { return Code::kNotFound; } - leveldb::Status status = db->Delete(woptions, key); + rocksdb::Status status = db->Delete(woptions, key); if (status.ok()) { return Code::kOk; } @@ -149,11 +149,11 @@ class DBHandler : virtual public DBIf { Code Write(const DBHandle& dbhandle, const std::vector & batch, const WriteOptions& options) { - leveldb::WriteOptions woptions; - leveldb::WriteBatch lbatch; + rocksdb::WriteOptions woptions; + rocksdb::WriteBatch lbatch; woptions.sync = options.sync; woptions.disableWAL = options.disableWAL; - leveldb::Slice key, value; + rocksdb::Slice key, value; for (unsigned int i = 0; i < batch.size(); i++) { kv one = batch[i]; key.data_ = one.key.data.data(); @@ -162,11 +162,11 @@ class DBHandler : virtual public DBIf { value.size_ = one.value.size; lbatch.Put(key, value); } - leveldb::DB* db = openHandles->get(dbhandle.dbname, NULL); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, NULL); if (db == NULL) { return Code::kNotFound; } - leveldb::Status status = db->Write(woptions, &lbatch); + rocksdb::Status status = db->Write(woptions, &lbatch); if (status.ok()) { return Code::kOk; } @@ -178,15 +178,15 @@ class DBHandler : virtual public DBIf { struct onehandle* thishandle; _return.status = Code::kNotFound; std::string ret; - leveldb::Slice ikey; + rocksdb::Slice ikey; ikey.data_ = inputkey.data.data(); ikey.size_ = inputkey.size; - leveldb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); if (db == NULL) { return; } assert(thishandle != NULL); - const leveldb::Snapshot* s = NULL; + const rocksdb::Snapshot* s = NULL; if (options.snapshot.snapshotid > 0) { s = thishandle->lookupSnapshot(options.snapshot.snapshotid); assert(s != NULL); @@ -194,12 +194,12 @@ class DBHandler : virtual public DBIf { return; } } - leveldb::ReadOptions roptions; + rocksdb::ReadOptions roptions; roptions.verify_checksums = options.verify_checksums; roptions.fill_cache = options.fill_cache; roptions.snapshot = s; - leveldb::Status status = db->Get(roptions, ikey, &ret); + rocksdb::Status status = db->Get(roptions, ikey, &ret); if (status.ok()) { _return.value.data = ret.data(); _return.value.size = ret.size(); @@ -212,14 +212,14 @@ class DBHandler : virtual public DBIf { const Slice& target) { struct onehandle* thishandle; _return.status = Code::kNotFound; - leveldb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); if (db == NULL) { return; } assert(thishandle != NULL); // check to see if snapshot is specified - const leveldb::Snapshot* s = NULL; + const rocksdb::Snapshot* s = NULL; if (options.snapshot.snapshotid > 0) { s = thishandle->lookupSnapshot(options.snapshot.snapshotid); assert(s != NULL); @@ -229,11 +229,11 @@ class DBHandler : virtual public DBIf { } // create leveldb iterator - leveldb::ReadOptions roptions; + rocksdb::ReadOptions roptions; roptions.verify_checksums = options.verify_checksums; roptions.fill_cache = options.fill_cache; roptions.snapshot = s; - leveldb::Iterator* iter = db->NewIterator(roptions); + rocksdb::Iterator* iter = db->NewIterator(roptions); if (iter == NULL) { return; } @@ -244,7 +244,7 @@ class DBHandler : virtual public DBIf { } else if (iteratorType == IteratorType::seekToLast) { iter->SeekToLast(); } else if (iteratorType == IteratorType::seekToKey) { - leveldb::Slice key; + rocksdb::Slice key; key.data_ = target.data.data(); key.size_ = target.size; iter->Seek(key); @@ -264,14 +264,14 @@ class DBHandler : virtual public DBIf { Code DeleteIterator(const DBHandle& dbhandle, const Iterator& iterator) { // find the db struct onehandle* thishandle; - leveldb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); if (db == NULL) { return kNotFound; } assert(thishandle != NULL); // find the leveldb iterator for this db - leveldb::Iterator* it = + rocksdb::Iterator* it = thishandle->lookupIterator(iterator.iteratorid); if (it == NULL) { // this must have been cleaned up by the last call to GetNext @@ -289,14 +289,14 @@ class DBHandler : virtual public DBIf { // find the db struct onehandle* thishandle; _return.status = Code::kNotFound; - leveldb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); if (db == NULL) { return; } assert(thishandle != NULL); // find the leveldb iterator for this db - leveldb::Iterator* it = + rocksdb::Iterator* it = thishandle->lookupIterator(iterator.iteratorid); assert(it != NULL); if (it == NULL) { @@ -322,8 +322,8 @@ class DBHandler : virtual public DBIf { } // find current key-value - leveldb::Slice key = it->key(); - leveldb::Slice value = it->value(); + rocksdb::Slice key = it->key(); + rocksdb::Slice value = it->value(); // pack results back to client _return.keyvalue.key.data.assign(key.data_, key.size_); @@ -355,12 +355,12 @@ class DBHandler : virtual public DBIf { void GetSnapshot(ResultSnapshot& _return, const DBHandle& dbhandle) { _return.status = kIOError; struct onehandle* thishandle; - leveldb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); if (db == NULL) { return; } // create leveldb snapshot - const leveldb::Snapshot* s = db->GetSnapshot(); + const rocksdb::Snapshot* s = db->GetSnapshot(); // store snapshot in dbhandle, get unique id. int64_t id = thishandle->addSnapshot(s); @@ -370,11 +370,11 @@ class DBHandler : virtual public DBIf { Code ReleaseSnapshot(const DBHandle& dbhandle, const Snapshot& snapshot) { struct onehandle* thishandle; - leveldb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, &thishandle); if (db == NULL) { return kNotFound; } - const leveldb::Snapshot* s = thishandle->removeSnapshot(snapshot.snapshotid); + const rocksdb::Snapshot* s = thishandle->removeSnapshot(snapshot.snapshotid); if (s == NULL) { return Code::kNotFound; } @@ -384,14 +384,14 @@ class DBHandler : virtual public DBIf { Code CompactRange(const DBHandle& dbhandle, const Slice& begin, const Slice& end) { - leveldb::DB* db = openHandles->get(dbhandle.dbname, NULL); + rocksdb::DB* db = openHandles->get(dbhandle.dbname, NULL); if (db == NULL) { return Code::kNotFound; } - leveldb::Slice k1, *start = &k1; + rocksdb::Slice k1, *start = &k1; k1.data_ = begin.data.data(); k1.size_ = begin.size; - leveldb::Slice k2, *stop = &k2; + rocksdb::Slice k2, *stop = &k2; k2.data_ = begin.data.data(); k2.size_ = begin.size; diff --git a/tools/db_repl_stress.cc b/tools/db_repl_stress.cc index a7b1ba060..c7191ba80 100644 --- a/tools/db_repl_stress.cc +++ b/tools/db_repl_stress.cc @@ -13,7 +13,7 @@ // --num_inserts = the num of inserts the first thread should perform. // --wal_ttl = the wal ttl for the run. -using namespace leveldb; +using namespace rocksdb; struct DataPumpThread { size_t no_records; diff --git a/tools/db_stress.cc b/tools/db_stress.cc index 619953dad..786a12e2c 100644 --- a/tools/db_stress.cc +++ b/tools/db_stress.cc @@ -103,7 +103,7 @@ static int FLAGS_min_write_buffer_number_to_merge = 0; static int FLAGS_max_background_compactions = 0; // This is initialized to default value of false -static leveldb::CompactionStyle FLAGS_compaction_style = leveldb::kCompactionStyleLevel; +static rocksdb::CompactionStyle FLAGS_compaction_style = rocksdb::kCompactionStyleLevel; // The ratio of file sizes that trigger compaction in universal style static unsigned int FLAGS_universal_size_ratio = 0; @@ -140,10 +140,10 @@ static const char* FLAGS_db = nullptr; static bool FLAGS_verify_checksum = false; // Allow reads to occur via mmap-ing files -static bool FLAGS_use_mmap_reads = leveldb::EnvOptions().use_mmap_reads; +static bool FLAGS_use_mmap_reads = rocksdb::EnvOptions().use_mmap_reads; // Database statistics -static std::shared_ptr dbstats; +static std::shared_ptr dbstats; // Sync all writes to disk static bool FLAGS_sync = false; @@ -206,11 +206,11 @@ static int FLAGS_disable_seek_compaction = false; static uint64_t FLAGS_delete_obsolete_files_period_micros = 0; // Algorithm to use to compress the database -static enum leveldb::CompressionType FLAGS_compression_type = - leveldb::kSnappyCompression; +static enum rocksdb::CompressionType FLAGS_compression_type = + rocksdb::kSnappyCompression; // posix or hdfs environment -static leveldb::Env* FLAGS_env = leveldb::Env::Default(); +static rocksdb::Env* FLAGS_env = rocksdb::Env::Default(); // Number of operations per thread. static uint32_t FLAGS_ops_per_thread = 600000; @@ -242,7 +242,7 @@ static bool FLAGS_prefix_size = 0; // On true, replaces all writes with a Merge that behaves like a Put static bool FLAGS_use_merge_put = false; -namespace leveldb { +namespace rocksdb { // convert long to a big-endian slice key static std::string Key(long val) { @@ -1206,16 +1206,16 @@ class StressTest { const char* compression = ""; switch (FLAGS_compression_type) { - case leveldb::kNoCompression: + case rocksdb::kNoCompression: compression = "none"; break; - case leveldb::kSnappyCompression: + case rocksdb::kSnappyCompression: compression = "snappy"; break; - case leveldb::kZlibCompression: + case rocksdb::kZlibCompression: compression = "zlib"; break; - case leveldb::kBZip2Compression: + case rocksdb::kBZip2Compression: compression = "bzip2"; break; } @@ -1380,26 +1380,26 @@ class StressTest { int num_times_reopened_; }; -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - FLAGS_write_buffer_size = leveldb::Options().write_buffer_size; - FLAGS_max_write_buffer_number = leveldb::Options().max_write_buffer_number; + FLAGS_write_buffer_size = rocksdb::Options().write_buffer_size; + FLAGS_max_write_buffer_number = rocksdb::Options().max_write_buffer_number; FLAGS_min_write_buffer_number_to_merge = - leveldb::Options().min_write_buffer_number_to_merge; - FLAGS_open_files = leveldb::Options().max_open_files; + rocksdb::Options().min_write_buffer_number_to_merge; + FLAGS_open_files = rocksdb::Options().max_open_files; FLAGS_max_background_compactions = - leveldb::Options().max_background_compactions; + rocksdb::Options().max_background_compactions; FLAGS_compaction_style = - leveldb::Options().compaction_style; + rocksdb::Options().compaction_style; FLAGS_level0_file_num_compaction_trigger = - leveldb::Options().level0_file_num_compaction_trigger; + rocksdb::Options().level0_file_num_compaction_trigger; FLAGS_level0_slowdown_writes_trigger = - leveldb::Options().level0_slowdown_writes_trigger; + rocksdb::Options().level0_slowdown_writes_trigger; FLAGS_level0_stop_writes_trigger = - leveldb::Options().level0_stop_writes_trigger; + rocksdb::Options().level0_stop_writes_trigger; // Compression test code above refers to FLAGS_block_size - FLAGS_block_size = leveldb::Options().block_size; + FLAGS_block_size = rocksdb::Options().block_size; std::string default_db_path; for (int i = 1; i < argc; i++) { @@ -1448,7 +1448,7 @@ int main(int argc, char** argv) { } else if (sscanf(argv[i], "--max_background_compactions=%d%c", &n, &junk) == 1) { FLAGS_max_background_compactions = n; } else if (sscanf(argv[i], "--compaction_style=%d%c", &n, &junk) == 1) { - FLAGS_compaction_style = (leveldb::CompactionStyle)n; + FLAGS_compaction_style = (rocksdb::CompactionStyle)n; } else if (sscanf(argv[i], "--cache_size=%ld%c", &l, &junk) == 1) { FLAGS_cache_size = l; } else if (sscanf(argv[i], "--block_size=%d%c", &n, &junk) == 1) { @@ -1470,7 +1470,7 @@ int main(int argc, char** argv) { } else if (sscanf(argv[i], "--statistics=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) { if (n == 1) { - dbstats = leveldb::CreateDBStatistics(); + dbstats = rocksdb::CreateDBStatistics(); } } else if (sscanf(argv[i], "--sync=%d%c", &n, &junk) == 1 && (n == 0 || n == 1)) { @@ -1505,7 +1505,7 @@ int main(int argc, char** argv) { (n == 0 || n == 1)) { FLAGS_disable_wal = n; } else if (sscanf(argv[i], "--hdfs=%s", hdfsname) == 1) { - FLAGS_env = new leveldb::HdfsEnv(hdfsname); + FLAGS_env = new rocksdb::HdfsEnv(hdfsname); } else if (sscanf(argv[i], "--target_file_size_base=%d%c", &n, &junk) == 1) { FLAGS_target_file_size_base = n; @@ -1530,13 +1530,13 @@ int main(int argc, char** argv) { } else if (strncmp(argv[i], "--compression_type=", 19) == 0) { const char* ctype = argv[i] + 19; if (!strcasecmp(ctype, "none")) - FLAGS_compression_type = leveldb::kNoCompression; + FLAGS_compression_type = rocksdb::kNoCompression; else if (!strcasecmp(ctype, "snappy")) - FLAGS_compression_type = leveldb::kSnappyCompression; + FLAGS_compression_type = rocksdb::kSnappyCompression; else if (!strcasecmp(ctype, "zlib")) - FLAGS_compression_type = leveldb::kZlibCompression; + FLAGS_compression_type = rocksdb::kZlibCompression; else if (!strcasecmp(ctype, "bzip2")) - FLAGS_compression_type = leveldb::kBZip2Compression; + FLAGS_compression_type = rocksdb::kBZip2Compression; else { fprintf(stdout, "Cannot parse %s\n", argv[i]); } @@ -1613,12 +1613,12 @@ int main(int argc, char** argv) { // Choose a location for the test database if none given with --db= if (FLAGS_db == nullptr) { - leveldb::Env::Default()->GetTestDirectory(&default_db_path); + rocksdb::Env::Default()->GetTestDirectory(&default_db_path); default_db_path += "/dbstress"; FLAGS_db = default_db_path.c_str(); } - leveldb::StressTest stress; + rocksdb::StressTest stress; stress.Run(); return 0; } diff --git a/tools/ldb.cc b/tools/ldb.cc index 7fb899265..561568c77 100644 --- a/tools/ldb.cc +++ b/tools/ldb.cc @@ -5,7 +5,7 @@ #include "rocksdb/ldb_tool.h" int main(int argc, char** argv) { - leveldb::LDBTool tool; + rocksdb::LDBTool tool; tool.Run(argc, argv); return 0; } diff --git a/tools/reduce_levels_test.cc b/tools/reduce_levels_test.cc index b520d364c..9eb381ef0 100644 --- a/tools/reduce_levels_test.cc +++ b/tools/reduce_levels_test.cc @@ -11,7 +11,7 @@ #include "util/testharness.h" #include "util/ldb_cmd.h" -namespace leveldb { +namespace rocksdb { class ReduceLevelTest { public: @@ -72,11 +72,11 @@ private: Status ReduceLevelTest::OpenDB(bool create_if_missing, int num_levels, int mem_table_compact_level) { - leveldb::Options opt; + rocksdb::Options opt; opt.num_levels = num_levels; opt.create_if_missing = create_if_missing; opt.max_mem_compaction_level = mem_table_compact_level; - leveldb::Status st = leveldb::DB::Open(opt, dbname_, &db_); + rocksdb::Status st = rocksdb::DB::Open(opt, dbname_, &db_); if (!st.ok()) { fprintf(stderr, "Can't open the db:%s\n", st.ToString().c_str()); } @@ -84,7 +84,7 @@ Status ReduceLevelTest::OpenDB(bool create_if_missing, int num_levels, } bool ReduceLevelTest::ReduceLevels(int target_level) { - std::vector args = leveldb::ReduceDBLevelsCommand::PrepareArgs( + std::vector args = rocksdb::ReduceDBLevelsCommand::PrepareArgs( dbname_, target_level, false); LDBCommand* level_reducer = LDBCommand::InitFromCmdLineArgs(args); level_reducer->Run(); @@ -193,5 +193,5 @@ TEST(ReduceLevelTest, All_Levels) { } int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/tools/shell/DBClientProxy.cpp b/tools/shell/DBClientProxy.cpp index a1ec7b854..93277ac18 100644 --- a/tools/shell/DBClientProxy.cpp +++ b/tools/shell/DBClientProxy.cpp @@ -16,7 +16,7 @@ using namespace Tleveldb; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; -namespace leveldb { +namespace rocksdb { DBClientProxy::DBClientProxy(const string & host, int port) : host_(host), diff --git a/tools/shell/DBClientProxy.h b/tools/shell/DBClientProxy.h index 3be7d1a73..86669eed2 100644 --- a/tools/shell/DBClientProxy.h +++ b/tools/shell/DBClientProxy.h @@ -18,7 +18,7 @@ * it's client codes' responsibility to catch all possible exceptions. */ -namespace leveldb { +namespace rocksdb { class DBClientProxy : private boost::noncopyable { public: @@ -52,12 +52,12 @@ class DBClientProxy : private boost::noncopyable { // some internal help functions void cleanUp(void); void open(const std::string & db); - std::map::iterator getHandle(const std::string & db); + std::map::iterator getHandle(const std::string & db); const std::string host_; const int port_; - std::map dbToHandle_; - boost::shared_ptr dbClient_; + std::map dbToHandle_; + boost::shared_ptr dbClient_; }; } // namespace diff --git a/tools/shell/ShellContext.cpp b/tools/shell/ShellContext.cpp index 36a07e544..05a9bb81c 100644 --- a/tools/shell/ShellContext.cpp +++ b/tools/shell/ShellContext.cpp @@ -16,7 +16,7 @@ using namespace std; using namespace boost; using namespace Tleveldb; -using namespace leveldb; +using namespace rocksdb; using namespace apache::thrift::protocol; using namespace apache::thrift::transport; diff --git a/tools/shell/ShellContext.h b/tools/shell/ShellContext.h index 95805ad0c..5c2b94482 100644 --- a/tools/shell/ShellContext.h +++ b/tools/shell/ShellContext.h @@ -45,7 +45,7 @@ class ShellContext : private boost::noncopyable { int argc_; char ** argv_; int port_; - boost::shared_ptr clientProxy_; + boost::shared_ptr clientProxy_; }; #endif diff --git a/tools/shell/test/DBClientProxyTest.cpp b/tools/shell/test/DBClientProxyTest.cpp index 27e1c8563..3b64ffc5f 100644 --- a/tools/shell/test/DBClientProxyTest.cpp +++ b/tools/shell/test/DBClientProxyTest.cpp @@ -19,7 +19,7 @@ #include "../DBClientProxy.h" -using namespace leveldb; +using namespace rocksdb; using namespace apache::thrift; diff --git a/tools/sst_dump.cc b/tools/sst_dump.cc index b6ef26988..b7d721ef4 100644 --- a/tools/sst_dump.cc +++ b/tools/sst_dump.cc @@ -19,7 +19,7 @@ #include "util/testharness.h" #include "util/testutil.h" -namespace leveldb { +namespace rocksdb { class SstFileReader { public: @@ -119,7 +119,7 @@ Status SstFileReader::ReadSequential(bool print_kv, return ret; } -} // namespace leveldb +} // namespace rocksdb static void print_help() { fprintf(stderr, @@ -206,8 +206,8 @@ int main(int argc, char** argv) { } std::vector filenames; - leveldb::Env* env = leveldb::Env::Default(); - leveldb::Status st = env->GetChildren(dir_or_file, &filenames); + rocksdb::Env* env = rocksdb::Env::Default(); + rocksdb::Status st = env->GetChildren(dir_or_file, &filenames); bool dir = true; if (!st.ok()) { filenames.clear(); @@ -215,8 +215,8 @@ int main(int argc, char** argv) { dir = false; } - std::cout << "from [" << leveldb::Slice(from_key).ToString(true) - << "] to [" << leveldb::Slice(to_key).ToString(true) << "]\n"; + std::cout << "from [" << rocksdb::Slice(from_key).ToString(true) + << "] to [" << rocksdb::Slice(to_key).ToString(true) << "]\n"; uint64_t total_read = 0; for (size_t i = 0; i < filenames.size(); i++) { @@ -229,9 +229,9 @@ int main(int argc, char** argv) { if(dir) { filename = std::string(dir_or_file) + "/" + filename; } - leveldb::SstFileReader reader(filename, verify_checksum, + rocksdb::SstFileReader reader(filename, verify_checksum, output_hex); - leveldb::Status st; + rocksdb::Status st; // scan all files in give file path. if (command == "" || command == "scan" || command == "check") { st = reader.ReadSequential(command != "check", diff --git a/util/arena_impl.cc b/util/arena_impl.cc index 6d39a80d7..0ba02a2f0 100644 --- a/util/arena_impl.cc +++ b/util/arena_impl.cc @@ -4,7 +4,7 @@ #include "util/arena_impl.h" -namespace leveldb { +namespace rocksdb { ArenaImpl::ArenaImpl(size_t block_size) { if (block_size < kMinBlockSize) { @@ -70,4 +70,4 @@ char* ArenaImpl::AllocateNewBlock(size_t block_bytes) { return result; } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/arena_impl.h b/util/arena_impl.h index 8c4a3f0b6..9b95c6fc3 100644 --- a/util/arena_impl.h +++ b/util/arena_impl.h @@ -15,7 +15,7 @@ #include #include "rocksdb/arena.h" -namespace leveldb { +namespace rocksdb { class ArenaImpl : public Arena { public: @@ -78,6 +78,6 @@ inline char* ArenaImpl::Allocate(size_t bytes) { return AllocateFallback(bytes); } -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_ARENA_IMPL_H_ diff --git a/util/arena_test.cc b/util/arena_test.cc index 13c6e9391..c67bb3b66 100644 --- a/util/arena_test.cc +++ b/util/arena_test.cc @@ -6,7 +6,7 @@ #include "util/random.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { class ArenaImplTest { }; @@ -98,8 +98,8 @@ TEST(ArenaImplTest, Simple) { } } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/auto_roll_logger.cc b/util/auto_roll_logger.cc index f4c37686c..8651e1f90 100644 --- a/util/auto_roll_logger.cc +++ b/util/auto_roll_logger.cc @@ -3,7 +3,7 @@ using namespace std; -namespace leveldb { +namespace rocksdb { // -- AutoRollLogger Status AutoRollLogger::ResetLogger() { @@ -100,4 +100,4 @@ Status CreateLoggerFromOptions( } } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/auto_roll_logger.h b/util/auto_roll_logger.h index 7e42b46a9..bd0ad68fb 100644 --- a/util/auto_roll_logger.h +++ b/util/auto_roll_logger.h @@ -12,7 +12,7 @@ #include "port/port.h" #include "util/posix_logger.h" -namespace leveldb { +namespace rocksdb { // Rolls the log file by size and/or time class AutoRollLogger : public Logger { @@ -88,6 +88,6 @@ Status CreateLoggerFromOptions( const Options& options, std::shared_ptr* logger); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_AUTO_ROLL_LOGGER_H diff --git a/util/auto_roll_logger_test.cc b/util/auto_roll_logger_test.cc index 7ee3809e5..d46285759 100755 --- a/util/auto_roll_logger_test.cc +++ b/util/auto_roll_logger_test.cc @@ -13,7 +13,7 @@ using namespace std; -namespace leveldb { +namespace rocksdb { class AutoRollLoggerTest { public: @@ -254,8 +254,8 @@ int OldLogFileCount(const string& dir) { return log_file_count; } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/bit_set.h b/util/bit_set.h index 08c30d714..f64e38225 100644 --- a/util/bit_set.h +++ b/util/bit_set.h @@ -8,7 +8,7 @@ #include -namespace leveldb { +namespace rocksdb { class BitSet { public: diff --git a/util/bloom.cc b/util/bloom.cc index 1fffa0972..85f983af5 100644 --- a/util/bloom.cc +++ b/util/bloom.cc @@ -7,7 +7,7 @@ #include "rocksdb/slice.h" #include "util/hash.h" -namespace leveldb { +namespace rocksdb { namespace { static uint32_t BloomHash(const Slice& key) { @@ -103,4 +103,4 @@ const FilterPolicy* NewBloomFilterPolicy(int bits_per_key) { return new BloomFilterPolicy(bits_per_key); } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/bloom_test.cc b/util/bloom_test.cc index 84fac01db..62ff71257 100644 --- a/util/bloom_test.cc +++ b/util/bloom_test.cc @@ -8,7 +8,7 @@ #include "util/testharness.h" #include "util/testutil.h" -namespace leveldb { +namespace rocksdb { static const int kVerbose = 1; @@ -152,8 +152,8 @@ TEST(BloomTest, VaryingLengths) { // Different bits-per-byte -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/cache.cc b/util/cache.cc index 5a2ce38a6..e3586a3f0 100644 --- a/util/cache.cc +++ b/util/cache.cc @@ -11,7 +11,7 @@ #include "util/hash.h" #include "util/mutexlock.h" -namespace leveldb { +namespace rocksdb { Cache::~Cache() { } @@ -351,4 +351,4 @@ shared_ptr NewLRUCache(size_t capacity, int numShardBits) { return std::make_shared(capacity, numShardBits); } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/cache_test.cc b/util/cache_test.cc index cf2b3b048..16321559c 100644 --- a/util/cache_test.cc +++ b/util/cache_test.cc @@ -10,7 +10,7 @@ #include "util/coding.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { // Conversions between numeric keys/values and the types expected by Cache. static std::string EncodeKey(int k) { @@ -225,8 +225,8 @@ TEST(CacheTest, BadEviction) { std::cout << "Poor entries\n"; } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/coding.cc b/util/coding.cc index 4aefb2688..60bdf4410 100644 --- a/util/coding.cc +++ b/util/coding.cc @@ -6,7 +6,7 @@ #include -namespace leveldb { +namespace rocksdb { void EncodeFixed32(char* buf, uint32_t value) { #if __BYTE_ORDER == __LITTLE_ENDIAN @@ -298,4 +298,4 @@ uint64_t BitStreamGetInt(const Slice* src, size_t offset, return BitStreamGetInt(src->data(), src->size(), offset, bits); } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/coding.h b/util/coding.h index 336d1efde..ddd652904 100644 --- a/util/coding.h +++ b/util/coding.h @@ -15,7 +15,7 @@ #include #include "port/port.h" -namespace leveldb { +namespace rocksdb { // The maximum length of a varint in bytes for 32 and 64 bits respectively. const unsigned int kMaxVarint32Length = 5; @@ -129,6 +129,6 @@ extern uint64_t BitStreamGetInt(const std::string* src, size_t offset, extern uint64_t BitStreamGetInt(const Slice* src, size_t offset, uint32_t bits); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_CODING_H_ diff --git a/util/coding_test.cc b/util/coding_test.cc index b38970914..03befc5bb 100644 --- a/util/coding_test.cc +++ b/util/coding_test.cc @@ -6,7 +6,7 @@ #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { class Coding { }; @@ -284,8 +284,8 @@ TEST(Coding, BitStreamConvenienceFuncs) { ASSERT_EQ(BitStreamGetInt(&slice, 0, 64), (uint64_t)(-1)); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/comparator.cc b/util/comparator.cc index 16449d804..6ba1cacfd 100644 --- a/util/comparator.cc +++ b/util/comparator.cc @@ -9,7 +9,7 @@ #include "port/port.h" #include "util/logging.h" -namespace leveldb { +namespace rocksdb { Comparator::~Comparator() { } @@ -78,4 +78,4 @@ const Comparator* BytewiseComparator() { return bytewise; } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/crc32c.cc b/util/crc32c.cc index a4115dfcf..cd2d66e5b 100644 --- a/util/crc32c.cc +++ b/util/crc32c.cc @@ -13,7 +13,7 @@ #endif #include "util/coding.h" -namespace leveldb { +namespace rocksdb { namespace crc32c { static const uint32_t table0_[256] = { @@ -385,4 +385,4 @@ uint32_t Extend(uint32_t crc, const char* buf, size_t size) { } } // namespace crc32c -} // namespace leveldb +} // namespace rocksdb diff --git a/util/crc32c.h b/util/crc32c.h index 1d7e5c075..e7d420da7 100644 --- a/util/crc32c.h +++ b/util/crc32c.h @@ -8,7 +8,7 @@ #include #include -namespace leveldb { +namespace rocksdb { namespace crc32c { // Return the crc32c of concat(A, data[0,n-1]) where init_crc is the @@ -40,6 +40,6 @@ inline uint32_t Unmask(uint32_t masked_crc) { } } // namespace crc32c -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_CRC32C_H_ diff --git a/util/crc32c_test.cc b/util/crc32c_test.cc index 28ae5b79f..6736dfefa 100644 --- a/util/crc32c_test.cc +++ b/util/crc32c_test.cc @@ -5,7 +5,7 @@ #include "util/crc32c.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { namespace crc32c { class CRC { }; @@ -65,8 +65,8 @@ TEST(CRC, Mask) { } } // namespace crc32c -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/env.cc b/util/env.cc index 97d4c709d..6c27080c6 100644 --- a/util/env.cc +++ b/util/env.cc @@ -5,7 +5,7 @@ #include "rocksdb/env.h" #include "rocksdb/options.h" -namespace leveldb { +namespace rocksdb { Env::~Env() { } @@ -122,4 +122,4 @@ EnvOptions::EnvOptions() { } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/env_hdfs.cc b/util/env_hdfs.cc index 350164fa5..dfd5c7225 100644 --- a/util/env_hdfs.cc +++ b/util/env_hdfs.cc @@ -38,7 +38,7 @@ // will reside on the same HDFS cluster. // -namespace leveldb { +namespace rocksdb { namespace { @@ -153,7 +153,7 @@ class HdfsReadableFile: virtual public SequentialFile, virtual public RandomAcce size = pFileInfo->mSize; hdfsFreeFileInfo(pFileInfo, 1); } else { - throw leveldb::HdfsFatalException("fileSize on unknown file " + + throw rocksdb::HdfsFatalException("fileSize on unknown file " + filename_); } return size; @@ -505,7 +505,7 @@ Status HdfsEnv::NewLogger(const std::string& fname, return Status::OK(); } -} // namespace leveldb +} // namespace rocksdb #endif // LEVELDB_HDFS_FILE_C @@ -514,7 +514,7 @@ Status HdfsEnv::NewLogger(const std::string& fname, // dummy placeholders used when HDFS is not available #include "rocksdb/env.h" #include "hdfs/env_hdfs.h" -namespace leveldb { +namespace rocksdb { Status HdfsEnv::NewSequentialFile(const std::string& fname, unique_ptr* result, const EnvOptions& options) { diff --git a/util/env_posix.cc b/util/env_posix.cc index db1b51493..8f9d88133 100644 --- a/util/env_posix.cc +++ b/util/env_posix.cc @@ -50,7 +50,7 @@ // If non-zero, kill at various points in source code with probability 1/this int leveldb_kill_odds = 0; -namespace leveldb { +namespace rocksdb { namespace { @@ -1275,4 +1275,4 @@ Env* Env::Default() { return &default_env; } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/env_test.cc b/util/env_test.cc index f803bb440..357edb3a5 100644 --- a/util/env_test.cc +++ b/util/env_test.cc @@ -12,7 +12,7 @@ #include "util/mutexlock.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { static const int kDelayMicros = 100000; @@ -357,8 +357,8 @@ TEST(EnvPosixTest, InvalidateCache) { ASSERT_OK(env_->DeleteFile(fname)); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/filelock_test.cc b/util/filelock_test.cc index 8738be72a..247dd5aa9 100644 --- a/util/filelock_test.cc +++ b/util/filelock_test.cc @@ -9,16 +9,16 @@ #include "util/coding.h" #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { class LockTest { public: static LockTest* current_; std::string file_; - leveldb::Env* env_; + rocksdb::Env* env_; LockTest() : file_(test::TmpDir() + "/db_testlock_file"), - env_(leveldb::Env::Default()) { + env_(rocksdb::Env::Default()) { current_ = this; } @@ -50,8 +50,8 @@ TEST(LockTest, LockBySameThread) { } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/filter_policy.cc b/util/filter_policy.cc index df338ee46..49cf80b05 100644 --- a/util/filter_policy.cc +++ b/util/filter_policy.cc @@ -4,8 +4,8 @@ #include "rocksdb/filter_policy.h" -namespace leveldb { +namespace rocksdb { FilterPolicy::~FilterPolicy() { } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/hash.cc b/util/hash.cc index ba1818082..62de085c5 100644 --- a/util/hash.cc +++ b/util/hash.cc @@ -6,7 +6,7 @@ #include "util/coding.h" #include "util/hash.h" -namespace leveldb { +namespace rocksdb { uint32_t Hash(const char* data, size_t n, uint32_t seed) { // Similar to murmur hash @@ -42,4 +42,4 @@ uint32_t Hash(const char* data, size_t n, uint32_t seed) { } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/hash.h b/util/hash.h index 8889d56be..806c55bfa 100644 --- a/util/hash.h +++ b/util/hash.h @@ -10,7 +10,7 @@ #include #include -namespace leveldb { +namespace rocksdb { extern uint32_t Hash(const char* data, size_t n, uint32_t seed); diff --git a/util/histogram.cc b/util/histogram.cc index e7e993b30..f31415410 100644 --- a/util/histogram.cc +++ b/util/histogram.cc @@ -9,7 +9,7 @@ #include #include "port/port.h" -namespace leveldb { +namespace rocksdb { HistogramBucketMapper::HistogramBucketMapper() : // Add newer bucket index here. diff --git a/util/histogram.h b/util/histogram.h index 3d10d93c4..b945a19ff 100644 --- a/util/histogram.h +++ b/util/histogram.h @@ -12,7 +12,7 @@ #include #include -namespace leveldb { +namespace rocksdb { class HistogramBucketMapper { public: @@ -73,6 +73,6 @@ class HistogramImpl { }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_HISTOGRAM_H_ diff --git a/util/histogram_test.cc b/util/histogram_test.cc index 158682af8..3e1d6c5c4 100644 --- a/util/histogram_test.cc +++ b/util/histogram_test.cc @@ -2,7 +2,7 @@ #include "util/testharness.h" -namespace leveldb { +namespace rocksdb { class HistogramTest { }; @@ -50,8 +50,8 @@ TEST(HistogramTest, ClearHistogram) { ASSERT_EQ(histogram.Average(), 0); } -} // namespace leveldb +} // namespace rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/ldb_cmd.cc b/util/ldb_cmd.cc index 95286d3fe..3117e713d 100644 --- a/util/ldb_cmd.cc +++ b/util/ldb_cmd.cc @@ -18,7 +18,7 @@ #include #include -namespace leveldb { +namespace rocksdb { using namespace std; diff --git a/util/ldb_cmd.h b/util/ldb_cmd.h index baf367e8d..45a3d707c 100644 --- a/util/ldb_cmd.h +++ b/util/ldb_cmd.h @@ -28,7 +28,7 @@ using std::map; using std::vector; using std::ostringstream; -namespace leveldb { +namespace rocksdb { class LDBCommand { public: @@ -680,5 +680,5 @@ private: static const char* DELETE_CMD; }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_LDB_CMD_H_ diff --git a/util/ldb_cmd_execute_result.h b/util/ldb_cmd_execute_result.h index fb94a20b9..3e28e9639 100644 --- a/util/ldb_cmd_execute_result.h +++ b/util/ldb_cmd_execute_result.h @@ -1,7 +1,7 @@ #ifndef LEVELDB_UTIL_LDB_CMD_EXECUTE_RESULT_H_ #define LEVELDB_UTIL_LDB_CMD_EXECUTE_RESULT_H_ -namespace leveldb { +namespace rocksdb { class LDBCommandExecuteResult { public: diff --git a/util/ldb_tool.cc b/util/ldb_tool.cc index d04ecd972..17fd18f77 100644 --- a/util/ldb_tool.cc +++ b/util/ldb_tool.cc @@ -3,7 +3,7 @@ #include "rocksdb/ldb_tool.h" #include "util/ldb_cmd.h" -namespace leveldb { +namespace rocksdb { class LDBCommandRunner { public: @@ -96,5 +96,5 @@ public: void LDBTool::Run(int argc, char** argv, Options options) { LDBCommandRunner::RunCommand(argc, argv, options); } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/logging.cc b/util/logging.cc index a0f7f0ece..656eeaa3e 100644 --- a/util/logging.cc +++ b/util/logging.cc @@ -11,7 +11,7 @@ #include "rocksdb/env.h" #include "rocksdb/slice.h" -namespace leveldb { +namespace rocksdb { void AppendNumberTo(std::string* str, uint64_t num) { char buf[30]; @@ -78,4 +78,4 @@ bool ConsumeDecimalNumber(Slice* in, uint64_t* val) { return (digits > 0); } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/logging.h b/util/logging.h index b0c5da813..a90ae5dd2 100644 --- a/util/logging.h +++ b/util/logging.h @@ -13,7 +13,7 @@ #include #include "port/port.h" -namespace leveldb { +namespace rocksdb { class Slice; class WritableFile; @@ -42,6 +42,6 @@ extern bool ConsumeChar(Slice* in, char c); // unspecified state. extern bool ConsumeDecimalNumber(Slice* in, uint64_t* val); -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_LOGGING_H_ diff --git a/util/manual_compaction_test.cc b/util/manual_compaction_test.cc index db1e8d2b4..d2e8823f3 100644 --- a/util/manual_compaction_test.cc +++ b/util/manual_compaction_test.cc @@ -25,50 +25,50 @@ class ManualCompactionTest { }; TEST(ManualCompactionTest, Test) { // Get rid of any state from an old run. - std::string dbpath = leveldb::test::TmpDir() + "/leveldb_cbug_test"; - DestroyDB(dbpath, leveldb::Options()); + std::string dbpath = rocksdb::test::TmpDir() + "/leveldb_cbug_test"; + DestroyDB(dbpath, rocksdb::Options()); // Open database. Disable compression since it affects the creation // of layers and the code below is trying to test against a very // specific scenario. - leveldb::DB* db; - leveldb::Options db_options; + rocksdb::DB* db; + rocksdb::Options db_options; db_options.create_if_missing = true; - db_options.compression = leveldb::kNoCompression; - ASSERT_OK(leveldb::DB::Open(db_options, dbpath, &db)); + db_options.compression = rocksdb::kNoCompression; + ASSERT_OK(rocksdb::DB::Open(db_options, dbpath, &db)); // create first key range - leveldb::WriteBatch batch; + rocksdb::WriteBatch batch; for (int i = 0; i < kNumKeys; i++) { batch.Put(Key1(i), "value for range 1 key"); } - ASSERT_OK(db->Write(leveldb::WriteOptions(), &batch)); + ASSERT_OK(db->Write(rocksdb::WriteOptions(), &batch)); // create second key range batch.Clear(); for (int i = 0; i < kNumKeys; i++) { batch.Put(Key2(i), "value for range 2 key"); } - ASSERT_OK(db->Write(leveldb::WriteOptions(), &batch)); + ASSERT_OK(db->Write(rocksdb::WriteOptions(), &batch)); // delete second key range batch.Clear(); for (int i = 0; i < kNumKeys; i++) { batch.Delete(Key2(i)); } - ASSERT_OK(db->Write(leveldb::WriteOptions(), &batch)); + ASSERT_OK(db->Write(rocksdb::WriteOptions(), &batch)); // compact database std::string start_key = Key1(0); std::string end_key = Key1(kNumKeys - 1); - leveldb::Slice least(start_key.data(), start_key.size()); - leveldb::Slice greatest(end_key.data(), end_key.size()); + rocksdb::Slice least(start_key.data(), start_key.size()); + rocksdb::Slice greatest(end_key.data(), end_key.size()); // commenting out the line below causes the example to work correctly db->CompactRange(&least, &greatest); // count the keys - leveldb::Iterator* iter = db->NewIterator(leveldb::ReadOptions()); + rocksdb::Iterator* iter = db->NewIterator(rocksdb::ReadOptions()); int num_keys = 0; for (iter->SeekToFirst(); iter->Valid(); iter->Next()) { num_keys++; @@ -78,11 +78,11 @@ TEST(ManualCompactionTest, Test) { // close database delete db; - DestroyDB(dbpath, leveldb::Options()); + DestroyDB(dbpath, rocksdb::Options()); } } // anonymous namespace int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } diff --git a/util/mutexlock.h b/util/mutexlock.h index 8817e55c9..4bd7f7fc6 100644 --- a/util/mutexlock.h +++ b/util/mutexlock.h @@ -7,7 +7,7 @@ #include "port/port.h" -namespace leveldb { +namespace rocksdb { // Helper class that locks a mutex on construction and unlocks the mutex when // the destructor of the MutexLock object is invoked. @@ -72,7 +72,7 @@ class WriteLock { void operator=(const WriteLock&); }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_MUTEXLOCK_H_ diff --git a/util/options.cc b/util/options.cc index 963449557..c54e3045c 100644 --- a/util/options.cc +++ b/util/options.cc @@ -13,7 +13,7 @@ #include "rocksdb/filter_policy.h" #include "rocksdb/merge_operator.h" -namespace leveldb { +namespace rocksdb { Options::Options() : comparator(BytewiseComparator()), @@ -292,4 +292,4 @@ Options::PrepareForBulkLoad() return this; } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/perf_context.cc b/util/perf_context.cc index ae980714c..31ae75201 100644 --- a/util/perf_context.cc +++ b/util/perf_context.cc @@ -1,6 +1,6 @@ #include "util/perf_context_imp.h" -namespace leveldb { +namespace rocksdb { // by default, enable counts only PerfLevel perf_level = kEnableCount; diff --git a/util/perf_context_imp.h b/util/perf_context_imp.h index 66df1c871..5c768cebb 100644 --- a/util/perf_context_imp.h +++ b/util/perf_context_imp.h @@ -4,7 +4,7 @@ #include "rocksdb/perf_context.h" #include "util/stop_watch.h" -namespace leveldb { +namespace rocksdb { extern enum PerfLevel perf_level; diff --git a/util/posix_logger.h b/util/posix_logger.h index 1ddba0069..e09e185fc 100644 --- a/util/posix_logger.h +++ b/util/posix_logger.h @@ -20,7 +20,7 @@ #include "rocksdb/env.h" #include -namespace leveldb { +namespace rocksdb { const int kDebugLogChunkSize = 128 * 1024; @@ -129,6 +129,6 @@ class PosixLogger : public Logger { } }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_POSIX_LOGGER_H_ diff --git a/util/random.h b/util/random.h index d64894fe8..6f36cd6d0 100644 --- a/util/random.h +++ b/util/random.h @@ -8,7 +8,7 @@ #include #include -namespace leveldb { +namespace rocksdb { // A very simple random number generator. Not especially good at // generating truly random bits, but good enough for our needs in this @@ -84,6 +84,6 @@ class Random64 { } }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_RANDOM_H_ diff --git a/util/signal_test.cc b/util/signal_test.cc index 64bb61049..6b65cbf53 100644 --- a/util/signal_test.cc +++ b/util/signal_test.cc @@ -19,7 +19,7 @@ void f3() { } int main() { - leveldb::InstallStackTraceHandler(); + rocksdb::InstallStackTraceHandler(); f3(); diff --git a/util/skiplistrep.cc b/util/skiplistrep.cc index ab768bf79..12ef52862 100644 --- a/util/skiplistrep.cc +++ b/util/skiplistrep.cc @@ -2,7 +2,7 @@ #include "db/memtable.h" #include "db/skiplist.h" -namespace leveldb { +namespace rocksdb { namespace { class SkipListRep : public MemTableRep { SkipList skip_list_; @@ -96,4 +96,4 @@ std::shared_ptr SkipListFactory::CreateMemTableRep ( return std::shared_ptr(new SkipListRep(compare, arena)); } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/slice.cc b/util/slice.cc index 5caa27d74..6d703e7f8 100644 --- a/util/slice.cc +++ b/util/slice.cc @@ -5,7 +5,7 @@ #include "rocksdb/slice_transform.h" #include "rocksdb/slice.h" -namespace leveldb { +namespace rocksdb { namespace { @@ -65,4 +65,4 @@ const SliceTransform* NewNoopTransform() { return new NoopTransform; } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/stack_trace.h b/util/stack_trace.h index 909f64e6d..bc29a3866 100644 --- a/util/stack_trace.h +++ b/util/stack_trace.h @@ -1,13 +1,13 @@ #ifndef STACK_TRACE_H #define STACK_TRACE_H -namespace leveldb { +namespace rocksdb { // Install a signal handler to print callstack on the following signals: // SIGILL SIGSEGV SIGBUS SIGABRT // Currently supports linux only. No-op otherwise. void InstallStackTraceHandler(); -} // namespace leveldb +} // namespace rocksdb #endif diff --git a/util/statistics.cc b/util/statistics.cc index b9ba8f1e7..1bc4a030f 100644 --- a/util/statistics.cc +++ b/util/statistics.cc @@ -1,7 +1,7 @@ #include "rocksdb/statistics.h" #include -namespace leveldb { +namespace rocksdb { namespace { // a buffer size used for temp string buffers @@ -52,4 +52,4 @@ std::string Statistics::ToString() { return res; } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/stats_logger.h b/util/stats_logger.h index a0799730f..0fac03038 100644 --- a/util/stats_logger.h +++ b/util/stats_logger.h @@ -1,7 +1,7 @@ #ifndef STATS_LOGGER_H_ #define STATS_LOGGER_H_ -namespace leveldb { +namespace rocksdb { class StatsLogger { diff --git a/util/status.cc b/util/status.cc index 31dcbba17..8d01800cc 100644 --- a/util/status.cc +++ b/util/status.cc @@ -6,7 +6,7 @@ #include "port/port.h" #include "rocksdb/status.h" -namespace leveldb { +namespace rocksdb { const char* Status::CopyState(const char* state) { uint32_t size; @@ -75,4 +75,4 @@ std::string Status::ToString() const { } } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/stl_wrappers.h b/util/stl_wrappers.h index 60b86cda9..512932301 100644 --- a/util/stl_wrappers.h +++ b/util/stl_wrappers.h @@ -7,7 +7,7 @@ #include "rocksdb/memtablerep.h" #include "rocksdb/slice.h" -namespace leveldb { +namespace rocksdb { namespace stl_wrappers { class Base { protected: diff --git a/util/stop_watch.h b/util/stop_watch.h index 8ccf2a006..e70579c8b 100644 --- a/util/stop_watch.h +++ b/util/stop_watch.h @@ -4,7 +4,7 @@ #include "rocksdb/env.h" #include "rocksdb/statistics.h" -namespace leveldb { +namespace rocksdb { // Auto-scoped. // Records the statistic into the corresponding histogram. class StopWatch { @@ -64,5 +64,5 @@ class StopWatchNano { uint64_t start_; }; -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_STOP_WATCH_H_ diff --git a/util/string_util.cc b/util/string_util.cc index b7529f636..516a19aa7 100644 --- a/util/string_util.cc +++ b/util/string_util.cc @@ -4,7 +4,7 @@ #include #include -namespace leveldb { +namespace rocksdb { using namespace std; using std::string; diff --git a/util/string_util.h b/util/string_util.h index 8c70d3e9b..f682d321a 100644 --- a/util/string_util.h +++ b/util/string_util.h @@ -3,7 +3,7 @@ #ifndef STORAGE_LEVELDB_UTIL_STRINGUTIL_H_ #define STORAGE_LEVELDB_UTIL_STRINGUTIL_H_ -namespace leveldb { +namespace rocksdb { extern std::vector stringSplit(std::string arg, char delim); diff --git a/util/testharness.cc b/util/testharness.cc index 5a3c84278..b8eeca81e 100644 --- a/util/testharness.cc +++ b/util/testharness.cc @@ -9,7 +9,7 @@ #include #include -namespace leveldb { +namespace rocksdb { namespace test { namespace { @@ -74,4 +74,4 @@ int RandomSeed() { } } // namespace test -} // namespace leveldb +} // namespace rocksdb diff --git a/util/testharness.h b/util/testharness.h index 3e0326044..0adf63277 100644 --- a/util/testharness.h +++ b/util/testharness.h @@ -12,7 +12,7 @@ #include "rocksdb/slice.h" #include "util/random.h" -namespace leveldb { +namespace rocksdb { namespace test { // Run some of the tests registered by the TEST() macro. If the @@ -102,14 +102,14 @@ class Tester { } }; -#define ASSERT_TRUE(c) ::leveldb::test::Tester(__FILE__, __LINE__).Is((c), #c) -#define ASSERT_OK(s) ::leveldb::test::Tester(__FILE__, __LINE__).IsOk((s)) -#define ASSERT_EQ(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsEq((a),(b)) -#define ASSERT_NE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsNe((a),(b)) -#define ASSERT_GE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsGe((a),(b)) -#define ASSERT_GT(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsGt((a),(b)) -#define ASSERT_LE(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLe((a),(b)) -#define ASSERT_LT(a,b) ::leveldb::test::Tester(__FILE__, __LINE__).IsLt((a),(b)) +#define ASSERT_TRUE(c) ::rocksdb::test::Tester(__FILE__, __LINE__).Is((c), #c) +#define ASSERT_OK(s) ::rocksdb::test::Tester(__FILE__, __LINE__).IsOk((s)) +#define ASSERT_EQ(a,b) ::rocksdb::test::Tester(__FILE__, __LINE__).IsEq((a),(b)) +#define ASSERT_NE(a,b) ::rocksdb::test::Tester(__FILE__, __LINE__).IsNe((a),(b)) +#define ASSERT_GE(a,b) ::rocksdb::test::Tester(__FILE__, __LINE__).IsGe((a),(b)) +#define ASSERT_GT(a,b) ::rocksdb::test::Tester(__FILE__, __LINE__).IsGt((a),(b)) +#define ASSERT_LE(a,b) ::rocksdb::test::Tester(__FILE__, __LINE__).IsLe((a),(b)) +#define ASSERT_LT(a,b) ::rocksdb::test::Tester(__FILE__, __LINE__).IsLt((a),(b)) #define TCONCAT(a,b) TCONCAT1(a,b) #define TCONCAT1(a,b) a##b @@ -124,7 +124,7 @@ class TCONCAT(_Test_,name) : public base { \ } \ }; \ bool TCONCAT(_Test_ignored_,name) = \ - ::leveldb::test::RegisterTest(#base, #name, &TCONCAT(_Test_,name)::_RunIt); \ + ::rocksdb::test::RegisterTest(#base, #name, &TCONCAT(_Test_,name)::_RunIt); \ void TCONCAT(_Test_,name)::_Run() // Register the specified test. Typically not used directly, but @@ -133,6 +133,6 @@ extern bool RegisterTest(const char* base, const char* name, void (*func)()); } // namespace test -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_TESTHARNESS_H_ diff --git a/util/testutil.cc b/util/testutil.cc index 0b110edc6..b30896cf1 100644 --- a/util/testutil.cc +++ b/util/testutil.cc @@ -6,7 +6,7 @@ #include "util/random.h" -namespace leveldb { +namespace rocksdb { namespace test { Slice RandomString(Random* rnd, int len, std::string* dst) { @@ -48,4 +48,4 @@ extern Slice CompressibleString(Random* rnd, double compressed_fraction, } } // namespace test -} // namespace leveldb +} // namespace rocksdb diff --git a/util/testutil.h b/util/testutil.h index e8f570e1e..7e9563bfb 100644 --- a/util/testutil.h +++ b/util/testutil.h @@ -9,7 +9,7 @@ #include "rocksdb/slice.h" #include "util/random.h" -namespace leveldb { +namespace rocksdb { namespace test { // Store in *dst a random string of length "len" and return a Slice that @@ -49,6 +49,6 @@ class ErrorEnv : public EnvWrapper { }; } // namespace test -} // namespace leveldb +} // namespace rocksdb #endif // STORAGE_LEVELDB_UTIL_TESTUTIL_H_ diff --git a/util/transformrep.cc b/util/transformrep.cc index 9add0b7d5..2756dae8f 100644 --- a/util/transformrep.cc +++ b/util/transformrep.cc @@ -15,14 +15,14 @@ namespace std { template <> -struct hash { - size_t operator()(const leveldb::Slice& slice) const { +struct hash { + size_t operator()(const rocksdb::Slice& slice) const { return MurmurHash(slice.data(), slice.size(), 0); } }; } -namespace leveldb { +namespace rocksdb { namespace { using namespace stl_wrappers; @@ -334,4 +334,4 @@ std::shared_ptr PrefixHashRep::GetPrefixIterator( return TransformRep::GetTransformIterator(prefix); } -} // namespace leveldb +} // namespace rocksdb diff --git a/util/vectorrep.cc b/util/vectorrep.cc index 744c9304c..aba605ec5 100644 --- a/util/vectorrep.cc +++ b/util/vectorrep.cc @@ -11,7 +11,7 @@ #include "util/mutexlock.h" #include "util/stl_wrappers.h" -namespace leveldb { +namespace rocksdb { namespace { using namespace stl_wrappers; @@ -241,4 +241,4 @@ std::shared_ptr VectorRepFactory::CreateMemTableRep( MemTableRep::KeyComparator& compare, Arena* arena) { return std::make_shared(compare, arena, count_); } -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/merge_operators.h b/utilities/merge_operators.h index 8557d75de..c3680308f 100644 --- a/utilities/merge_operators.h +++ b/utilities/merge_operators.h @@ -6,7 +6,7 @@ #include "rocksdb/merge_operator.h" -namespace leveldb { +namespace rocksdb { class MergeOperators { public: @@ -35,6 +35,6 @@ class MergeOperators { }; -} // namespace leveldb +} // namespace rocksdb #endif diff --git a/utilities/merge_operators/put.cc b/utilities/merge_operators/put.cc index d9f306096..e77449d32 100644 --- a/utilities/merge_operators/put.cc +++ b/utilities/merge_operators/put.cc @@ -3,7 +3,7 @@ #include "rocksdb/merge_operator.h" #include "utilities/merge_operators.h" -using namespace leveldb; +using namespace rocksdb; namespace { // anonymous namespace @@ -45,7 +45,7 @@ class PutOperator : public MergeOperator { } // end of anonymous namespace -namespace leveldb { +namespace rocksdb { std::shared_ptr MergeOperators::CreatePutOperator() { return std::make_shared(); diff --git a/utilities/merge_operators/string_append/stringappend.cc b/utilities/merge_operators/string_append/stringappend.cc index d55505d85..b36708c7b 100644 --- a/utilities/merge_operators/string_append/stringappend.cc +++ b/utilities/merge_operators/string_append/stringappend.cc @@ -13,7 +13,7 @@ #include "rocksdb/merge_operator.h" #include "utilities/merge_operators.h" -namespace leveldb { +namespace rocksdb { // Constructor: also specify the delimiter character. StringAppendOperator::StringAppendOperator(char delim_char) @@ -54,7 +54,7 @@ std::shared_ptr MergeOperators::CreateStringAppendOperator() { return std::make_shared(','); } -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/merge_operators/string_append/stringappend.h b/utilities/merge_operators/string_append/stringappend.h index 79fb31b51..40edb9f9f 100644 --- a/utilities/merge_operators/string_append/stringappend.h +++ b/utilities/merge_operators/string_append/stringappend.h @@ -8,7 +8,7 @@ #include "rocksdb/merge_operator.h" #include "rocksdb/slice.h" -namespace leveldb { +namespace rocksdb { class StringAppendOperator : public AssociativeMergeOperator { public: @@ -27,5 +27,5 @@ class StringAppendOperator : public AssociativeMergeOperator { }; -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/merge_operators/string_append/stringappend2.cc b/utilities/merge_operators/string_append/stringappend2.cc index 5b14d50ca..e153a388e 100644 --- a/utilities/merge_operators/string_append/stringappend2.cc +++ b/utilities/merge_operators/string_append/stringappend2.cc @@ -12,7 +12,7 @@ #include "rocksdb/merge_operator.h" #include "utilities/merge_operators.h" -namespace leveldb { +namespace rocksdb { // Constructor: also specify the delimiter character. StringAppendTESTOperator::StringAppendTESTOperator(char delim_char) @@ -100,5 +100,5 @@ MergeOperators::CreateStringAppendTESTOperator() { return std::make_shared(','); } -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/merge_operators/string_append/stringappend2.h b/utilities/merge_operators/string_append/stringappend2.h index 5b85ec170..734c7581a 100644 --- a/utilities/merge_operators/string_append/stringappend2.h +++ b/utilities/merge_operators/string_append/stringappend2.h @@ -14,7 +14,7 @@ #include "rocksdb/merge_operator.h" #include "rocksdb/slice.h" -namespace leveldb { +namespace rocksdb { class StringAppendTESTOperator : public MergeOperator { public: @@ -48,4 +48,4 @@ class StringAppendTESTOperator : public MergeOperator { }; -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/merge_operators/string_append/stringappend_test.cc b/utilities/merge_operators/string_append/stringappend_test.cc index 97061e205..a4dc596c0 100644 --- a/utilities/merge_operators/string_append/stringappend_test.cc +++ b/utilities/merge_operators/string_append/stringappend_test.cc @@ -18,9 +18,9 @@ #include "util/testharness.h" #include "util/random.h" -using namespace leveldb; +using namespace rocksdb; -namespace leveldb { +namespace rocksdb { // Path to the database on file system const std::string kDbName = "/tmp/mergetestdb"; @@ -139,7 +139,7 @@ TEST(StringAppendOperatorTest, IteratorTest) { slists.Append("k2", "a3"); std::string res; - std::unique_ptr it(db_->NewIterator(ReadOptions())); + std::unique_ptr it(db_->NewIterator(ReadOptions())); std::string k1("k1"); std::string k2("k2"); bool first = true; @@ -464,7 +464,7 @@ TEST(StringAppendOperatorTest, PersistentFlushAndCompaction) { // Append, Flush, Get slists.Append("c", "asdasd"); - db->Flush(leveldb::FlushOptions()); + db->Flush(rocksdb::FlushOptions()); success = slists.Get("c", &c); ASSERT_TRUE(success); ASSERT_EQ(c, "asdasd"); @@ -472,7 +472,7 @@ TEST(StringAppendOperatorTest, PersistentFlushAndCompaction) { // Append, Flush, Append, Get slists.Append("a", "x"); slists.Append("b", "y"); - db->Flush(leveldb::FlushOptions()); + db->Flush(rocksdb::FlushOptions()); slists.Append("a", "t"); slists.Append("a", "r"); slists.Append("b", "2"); @@ -543,7 +543,7 @@ TEST(StringAppendOperatorTest, PersistentFlushAndCompaction) { // Append, Flush, Compact, Get slists.Append("b", "afcg"); - db->Flush(leveldb::FlushOptions()); + db->Flush(rocksdb::FlushOptions()); db->CompactRange(nullptr, nullptr); slists.Get("b", &b); ASSERT_EQ(b, "y\n2\nmonkey\ndf\nl;\nafcg"); @@ -573,21 +573,21 @@ TEST(StringAppendOperatorTest, SimpleTestNullDelimiter) { ASSERT_EQ(res, checker); } -} // namespace leveldb +} // namespace rocksdb int main(int arc, char** argv) { // Run with regular database { fprintf(stderr, "Running tests with regular db and operator.\n"); StringAppendOperatorTest::SetOpenDbFunction(&OpenNormalDb); - leveldb::test::RunAllTests(); + rocksdb::test::RunAllTests(); } // Run with TTL { fprintf(stderr, "Running tests with ttl db and generic operator.\n"); StringAppendOperatorTest::SetOpenDbFunction(&OpenTtlDb); - leveldb::test::RunAllTests(); + rocksdb::test::RunAllTests(); } return 0; diff --git a/utilities/merge_operators/uint64add.cc b/utilities/merge_operators/uint64add.cc index 53a4aca5e..bd96e1928 100644 --- a/utilities/merge_operators/uint64add.cc +++ b/utilities/merge_operators/uint64add.cc @@ -5,7 +5,7 @@ #include "util/coding.h" #include "utilities/merge_operators.h" -using namespace leveldb; +using namespace rocksdb; namespace { // anonymous namespace @@ -56,7 +56,7 @@ class UInt64AddOperator : public AssociativeMergeOperator { } -namespace leveldb { +namespace rocksdb { std::shared_ptr MergeOperators::CreateUInt64AddOperator() { return std::make_shared(); diff --git a/utilities/redis/README b/utilities/redis/README index 84fff5cf9..8b17bc05a 100644 --- a/utilities/redis/README +++ b/utilities/redis/README @@ -1,5 +1,5 @@ This folder defines a REDIS-style interface for Rocksdb. -Right now it is written as a simple tag-on in the leveldb::RedisLists class. +Right now it is written as a simple tag-on in the rocksdb::RedisLists class. It implements Redis Lists, and supports only the "non-blocking operations". Internally, the set of lists are stored in a rocksdb database, mapping keys to diff --git a/utilities/redis/redis_list_exception.h b/utilities/redis/redis_list_exception.h index a9988b62d..ec349072d 100644 --- a/utilities/redis/redis_list_exception.h +++ b/utilities/redis/redis_list_exception.h @@ -10,7 +10,7 @@ #include -namespace leveldb { +namespace rocksdb { class RedisListException: public std::exception { public: @@ -19,6 +19,6 @@ class RedisListException: public std::exception { } }; -} // namespace leveldb +} // namespace rocksdb #endif // LEVELDB_REDIS_LIST_EXCEPTION_H diff --git a/utilities/redis/redis_list_iterator.h b/utilities/redis/redis_list_iterator.h index 4c614f200..d57f8ac94 100644 --- a/utilities/redis/redis_list_iterator.h +++ b/utilities/redis/redis_list_iterator.h @@ -45,7 +45,7 @@ #include "rocksdb/slice.h" #include "util/coding.h" -namespace leveldb { +namespace rocksdb { /// An abstraction over the "list" concept. /// All operations may throw a RedisListException @@ -305,4 +305,4 @@ class RedisListIterator { std::vector result_; // The output data }; -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/redis/redis_lists.cc b/utilities/redis/redis_lists.cc index 47e19df87..50c544a3a 100644 --- a/utilities/redis/redis_lists.cc +++ b/utilities/redis/redis_lists.cc @@ -30,7 +30,7 @@ #include "rocksdb/slice.h" #include "util/coding.h" -namespace leveldb +namespace rocksdb { /// Constructors diff --git a/utilities/redis/redis_lists.h b/utilities/redis/redis_lists.h index e6f973da2..8c149bc43 100644 --- a/utilities/redis/redis_lists.h +++ b/utilities/redis/redis_lists.h @@ -15,7 +15,7 @@ #include "redis_list_iterator.h" #include "redis_list_exception.h" -namespace leveldb { +namespace rocksdb { /// The Redis functionality (see http://redis.io/commands#list) /// All functions may THROW a RedisListException @@ -103,4 +103,4 @@ class RedisLists { std::unique_ptr db_; }; -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/redis/redis_lists_test.cc b/utilities/redis/redis_lists_test.cc index d1ad92e0e..9005c94cb 100644 --- a/utilities/redis/redis_lists_test.cc +++ b/utilities/redis/redis_lists_test.cc @@ -20,10 +20,10 @@ #include "util/testharness.h" #include "util/random.h" -using namespace leveldb; +using namespace rocksdb; using namespace std; -namespace leveldb { +namespace rocksdb { class RedisListsTest { public: @@ -868,7 +868,7 @@ int manual_redis_test(bool destructive){ } } -} // namespace leveldb +} // namespace rocksdb // USAGE: "./redis_test" for default (unit tests) @@ -892,9 +892,9 @@ bool found_arg(int argc, char* argv[], const char* want){ int main(int argc, char* argv[]) { if (found_arg(argc, argv, "-m")) { bool destructive = found_arg(argc, argv, "-d"); - return leveldb::manual_redis_test(destructive); + return rocksdb::manual_redis_test(destructive); } else { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); } } diff --git a/utilities/ttl/db_ttl.cc b/utilities/ttl/db_ttl.cc index 14c4ab47c..37df18f0e 100644 --- a/utilities/ttl/db_ttl.cc +++ b/utilities/ttl/db_ttl.cc @@ -8,7 +8,7 @@ #include "include/rocksdb/env.h" #include "include/rocksdb/iterator.h" -namespace leveldb { +namespace rocksdb { // Open the db inside DBWithTTL because options needs pointer to its ttl DBWithTTL::DBWithTTL(const int32_t ttl, @@ -294,4 +294,4 @@ void DBWithTTL::TEST_Destroy_DBWithTtl() { ((DBImpl*) db_)->TEST_Destroy_DBImpl(); } -} // namespace leveldb +} // namespace rocksdb diff --git a/utilities/ttl/db_ttl.h b/utilities/ttl/db_ttl.h index 63aeec622..fbee46528 100644 --- a/utilities/ttl/db_ttl.h +++ b/utilities/ttl/db_ttl.h @@ -12,7 +12,7 @@ #include "utilities/utility_db.h" #include "db/db_impl.h" -namespace leveldb { +namespace rocksdb { class DBWithTTL : public StackableDB { public: diff --git a/utilities/ttl/ttl_test.cc b/utilities/ttl/ttl_test.cc index 9c798dd39..fd367a957 100644 --- a/utilities/ttl/ttl_test.cc +++ b/utilities/ttl/ttl_test.cc @@ -10,7 +10,7 @@ #include #include -namespace leveldb { +namespace rocksdb { namespace { @@ -496,9 +496,9 @@ TEST(TtlTest, KeyMayExist) { CloseTtl(); } -} // namespace leveldb +} // namespace rocksdb // A black-box test for the ttl wrapper around rocksdb int main(int argc, char** argv) { - return leveldb::test::RunAllTests(); + return rocksdb::test::RunAllTests(); }