diff options
Diffstat (limited to 'include/leveldb/write_batch.h')
-rw-r--r-- | include/leveldb/write_batch.h | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/include/leveldb/write_batch.h b/include/leveldb/write_batch.h index 3411952..b4446c2 100644 --- a/include/leveldb/write_batch.h +++ b/include/leveldb/write_batch.h @@ -12,11 +12,17 @@ // batch.Delete("key"); // batch.Put("key", "v2"); // batch.Put("key", "v3"); +// +// Multiple threads can invoke const methods on a WriteBatch without +// external synchronization, but if any of the threads may call a +// non-const method, all threads accessing the same WriteBatch must use +// external synchronization. #ifndef STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ #define STORAGE_LEVELDB_INCLUDE_WRITE_BATCH_H_ #include <string> +#include "leveldb/status.h" namespace leveldb { @@ -36,6 +42,15 @@ class WriteBatch { // Clear all updates buffered in this batch. void Clear(); + // Support for iterating over the contents of a batch. + class Handler { + public: + virtual ~Handler(); + virtual void Put(const Slice& key, const Slice& value) = 0; + virtual void Delete(const Slice& key) = 0; + }; + Status Iterate(Handler* handler) const; + private: friend class WriteBatchInternal; |