Change namespace from leveldb to rocksdb

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

Test Plan: compile rocksdb

Reviewers: emayanke

Reviewed By: emayanke

CC: leveldb

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

View File

@@ -11,7 +11,7 @@
#include <limits>
#include <memory>
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_

View File

@@ -22,7 +22,7 @@
#include <stdint.h>
#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_

View File

@@ -7,7 +7,7 @@
#include <string>
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_

View File

@@ -7,7 +7,7 @@
#include <string>
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_

View File

@@ -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_

View File

@@ -20,7 +20,7 @@
#include <stdint.h>
#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_

View File

@@ -18,7 +18,7 @@
#include <string>
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_

View File

@@ -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_

View File

@@ -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

View File

@@ -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_

View File

@@ -9,7 +9,7 @@
#include <deque>
#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_

View File

@@ -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_

View File

@@ -3,7 +3,7 @@
#include <stdint.h>
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

View File

@@ -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;

View File

@@ -20,7 +20,7 @@
#include <string.h>
#include <string>
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_

View File

@@ -13,7 +13,7 @@
#include <string>
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_

View File

@@ -13,7 +13,7 @@
#include <memory>
#include <vector>
namespace leveldb {
namespace rocksdb {
/**
* Keep adding ticker's here.
@@ -258,6 +258,8 @@ inline void SetTickerCount(std::shared_ptr<Statistics> statistics,
}
}
} // namespace leveldb
} // namespace rocksdb
#include "rocksdb/rocksdb_to_leveldb.h"
#endif // STORAGE_ROCKSDB_INCLUDE_STATISTICS_H_

View File

@@ -16,7 +16,7 @@
#include <string>
#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_

View File

@@ -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_

View File

@@ -6,7 +6,7 @@
#include "rocksdb/types.h"
#include "rocksdb/write_batch.h"
namespace leveldb {
namespace rocksdb {
class LogFile;
typedef std::vector<std::unique_ptr<LogFile>> 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_

View File

@@ -3,12 +3,15 @@
#include <stdint.h>
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_

View File

@@ -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

View File

@@ -24,7 +24,7 @@
#include <string>
#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_