mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
[RocksDB] cleanup EnvOptions
Summary: This diff simplifies EnvOptions by treating it as POD, similar to Options. - virtual functions are removed and member fields are accessed directly. - StorageOptions is removed. - Options.allow_readahead and Options.allow_readahead_compactions are deprecated. - Unused global variables are removed: useOsBuffer, useFsReadAhead, useMmapRead, useMmapWrite Test Plan: make check; db_stress Reviewers: dhruba CC: leveldb Differential Revision: https://reviews.facebook.net/D11175
This commit is contained in:
@@ -23,16 +23,40 @@
|
||||
namespace leveldb {
|
||||
|
||||
class FileLock;
|
||||
class EnvOptions;
|
||||
class Logger;
|
||||
class RandomAccessFile;
|
||||
class SequentialFile;
|
||||
class Slice;
|
||||
class WritableFile;
|
||||
class Options;
|
||||
|
||||
using std::unique_ptr;
|
||||
using std::shared_ptr;
|
||||
|
||||
|
||||
// Options while opening a file to read/write
|
||||
struct EnvOptions {
|
||||
|
||||
// construct with default Options
|
||||
EnvOptions();
|
||||
|
||||
// construct from Options
|
||||
EnvOptions(const Options& options);
|
||||
|
||||
// If true, then allow caching of data in environment buffers
|
||||
bool use_os_buffer;
|
||||
|
||||
// If true, then use mmap to read data
|
||||
bool use_mmap_reads;
|
||||
|
||||
// If true, then use mmap to write data
|
||||
bool use_mmap_writes;
|
||||
|
||||
// If true, set the FD_CLOEXEC on open fd.
|
||||
bool set_fd_cloexec;
|
||||
|
||||
};
|
||||
|
||||
class Env {
|
||||
public:
|
||||
Env() { }
|
||||
@@ -375,27 +399,6 @@ class FileLock {
|
||||
void operator=(const FileLock&);
|
||||
};
|
||||
|
||||
// Options while opening a file to read/write
|
||||
class EnvOptions {
|
||||
public:
|
||||
virtual ~EnvOptions() {}
|
||||
|
||||
// If true, then allow caching of data in environment buffers
|
||||
virtual bool UseOsBuffer() const = 0;
|
||||
|
||||
// If true, then allow the environment to readahead data
|
||||
virtual bool UseReadahead() const = 0;
|
||||
|
||||
// If true, then use mmap to read data
|
||||
virtual bool UseMmapReads() const = 0;
|
||||
|
||||
// If true, then use mmap to write data
|
||||
virtual bool UseMmapWrites() const = 0;
|
||||
|
||||
// If true, set the FD_CLOEXEC on open fd.
|
||||
virtual bool IsFDCloseOnExec() const = 0;
|
||||
};
|
||||
|
||||
// Log the specified data to *info_log if info_log is non-nullptr.
|
||||
extern void Log(const shared_ptr<Logger>& info_log, const char* format, ...)
|
||||
# if defined(__GNUC__) || defined(__clang__)
|
||||
|
||||
@@ -409,11 +409,13 @@ struct Options {
|
||||
|
||||
// Reading a single block from a file can cause the OS/FS to start
|
||||
// readaheads of other blocks from the file. Default: true
|
||||
// Note: Deprecated
|
||||
bool allow_readahead;
|
||||
|
||||
// The reads triggered by compaction allows data to be readahead
|
||||
// by the OS/FS. This overrides the setting of 'allow_readahead'
|
||||
// for compaction-reads. Default: true
|
||||
// Note: Deprecated
|
||||
bool allow_readahead_compactions;
|
||||
|
||||
// Allow the OS to mmap file for reading. Default: false
|
||||
|
||||
Reference in New Issue
Block a user