diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/leveldb/env.h | 18 | ||||
-rw-r--r-- | include/leveldb/options.h | 6 | ||||
-rw-r--r-- | include/leveldb/status.h | 3 |
3 files changed, 27 insertions, 0 deletions
diff --git a/include/leveldb/env.h b/include/leveldb/env.h index f709514..99b6c21 100644 --- a/include/leveldb/env.h +++ b/include/leveldb/env.h @@ -69,6 +69,21 @@ class Env { virtual Status NewWritableFile(const std::string& fname, WritableFile** result) = 0; + // Create an object that either appends to an existing file, or + // writes to a new file (if the file does not exist to begin with). + // On success, stores a pointer to the new file in *result and + // returns OK. On failure stores NULL in *result and returns + // non-OK. + // + // The returned file will only be accessed by one thread at a time. + // + // May return an IsNotSupportedError error if this Env does + // not allow appending to an existing file. Users of Env (including + // the leveldb implementation) must be prepared to deal with + // an Env that does not support appending. + virtual Status NewAppendableFile(const std::string& fname, + WritableFile** result); + // Returns true iff the named file exists. virtual bool FileExists(const std::string& fname) = 0; @@ -289,6 +304,9 @@ class EnvWrapper : public Env { Status NewWritableFile(const std::string& f, WritableFile** r) { return target_->NewWritableFile(f, r); } + Status NewAppendableFile(const std::string& f, WritableFile** r) { + return target_->NewAppendableFile(f, r); + } bool FileExists(const std::string& f) { return target_->FileExists(f); } Status GetChildren(const std::string& dir, std::vector<std::string>* r) { return target_->GetChildren(dir, r); diff --git a/include/leveldb/options.h b/include/leveldb/options.h index 7c9b973..83a1ef3 100644 --- a/include/leveldb/options.h +++ b/include/leveldb/options.h @@ -128,6 +128,12 @@ struct Options { // efficiently detect that and will switch to uncompressed mode. CompressionType compression; + // EXPERIMENTAL: If true, append to existing MANIFEST and log files + // when a database is opened. This can significantly speed up open. + // + // Default: currently false, but may become true later. + bool reuse_logs; + // If non-NULL, use the specified filter policy to reduce disk reads. // Many applications will benefit from passing the result of // NewBloomFilterPolicy() here. diff --git a/include/leveldb/status.h b/include/leveldb/status.h index 11dbd4b..d2bdc22 100644 --- a/include/leveldb/status.h +++ b/include/leveldb/status.h @@ -60,6 +60,9 @@ class Status { // Returns true iff the status indicates an IOError. bool IsIOError() const { return code() == kIOError; } + // Returns true iff the status indicates a NotSupportedError. + bool IsNotSupportedError() const { return code() == kNotSupported; } + // Return a string representation of this status suitable for printing. // Returns the string "OK" for success. std::string ToString() const; |