aboutsummaryrefslogtreecommitdiff
path: root/db/write_batch_internal.h
diff options
context:
space:
mode:
authorVinnie Falco <vinnie.falco@gmail.com>2013-05-03 19:06:59 -0700
committerVinnie Falco <vinnie.falco@gmail.com>2013-05-03 19:06:59 -0700
commitc25e98186d0f716451ef000e55646d25e014f573 (patch)
treeaaf23800da380d055ecf533422905018eb8b6fe2 /db/write_batch_internal.h
Squashed 'src/leveldb/' content from commit aca1ffc
git-subtree-dir: src/leveldb git-subtree-split: aca1ffc4b65be5e099b2088c6e6a308d69e1ad73
Diffstat (limited to 'db/write_batch_internal.h')
-rw-r--r--db/write_batch_internal.h49
1 files changed, 49 insertions, 0 deletions
diff --git a/db/write_batch_internal.h b/db/write_batch_internal.h
new file mode 100644
index 0000000000..4423a7f318
--- /dev/null
+++ b/db/write_batch_internal.h
@@ -0,0 +1,49 @@
+// Copyright (c) 2011 The LevelDB Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file. See the AUTHORS file for names of contributors.
+
+#ifndef STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
+#define STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
+
+#include "leveldb/write_batch.h"
+
+namespace leveldb {
+
+class MemTable;
+
+// WriteBatchInternal provides static methods for manipulating a
+// WriteBatch that we don't want in the public WriteBatch interface.
+class WriteBatchInternal {
+ public:
+ // Return the number of entries in the batch.
+ static int Count(const WriteBatch* batch);
+
+ // Set the count for the number of entries in the batch.
+ static void SetCount(WriteBatch* batch, int n);
+
+ // Return the seqeunce number for the start of this batch.
+ static SequenceNumber Sequence(const WriteBatch* batch);
+
+ // Store the specified number as the seqeunce number for the start of
+ // this batch.
+ static void SetSequence(WriteBatch* batch, SequenceNumber seq);
+
+ static Slice Contents(const WriteBatch* batch) {
+ return Slice(batch->rep_);
+ }
+
+ static size_t ByteSize(const WriteBatch* batch) {
+ return batch->rep_.size();
+ }
+
+ static void SetContents(WriteBatch* batch, const Slice& contents);
+
+ static Status InsertInto(const WriteBatch* batch, MemTable* memtable);
+
+ static void Append(WriteBatch* dst, const WriteBatch* src);
+};
+
+} // namespace leveldb
+
+
+#endif // STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_