Feathercoin  0.5.0
P2P Digital Currency
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros
write_batch_internal.h
Go to the documentation of this file.
1 // Copyright (c) 2011 The LevelDB Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. See the AUTHORS file for names of contributors.
4 
5 #ifndef STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
6 #define STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
7 
8 #include "leveldb/write_batch.h"
9 
10 namespace leveldb {
11 
12 class MemTable;
13 
14 // WriteBatchInternal provides static methods for manipulating a
15 // WriteBatch that we don't want in the public WriteBatch interface.
17  public:
18  // Return the number of entries in the batch.
19  static int Count(const WriteBatch* batch);
20 
21  // Set the count for the number of entries in the batch.
22  static void SetCount(WriteBatch* batch, int n);
23 
24  // Return the seqeunce number for the start of this batch.
25  static SequenceNumber Sequence(const WriteBatch* batch);
26 
27  // Store the specified number as the seqeunce number for the start of
28  // this batch.
29  static void SetSequence(WriteBatch* batch, SequenceNumber seq);
30 
31  static Slice Contents(const WriteBatch* batch) {
32  return Slice(batch->rep_);
33  }
34 
35  static size_t ByteSize(const WriteBatch* batch) {
36  return batch->rep_.size();
37  }
38 
39  static void SetContents(WriteBatch* batch, const Slice& contents);
40 
41  static Status InsertInto(const WriteBatch* batch, MemTable* memtable);
42 
43  static void Append(WriteBatch* dst, const WriteBatch* src);
44 };
45 
46 } // namespace leveldb
47 
48 
49 #endif // STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
static void SetContents(WriteBatch *batch, const Slice &contents)
Definition: write_batch.cc:136
static void SetSequence(WriteBatch *batch, SequenceNumber seq)
Definition: write_batch.cc:94
static Slice Contents(const WriteBatch *batch)
uint64_t SequenceNumber
Definition: dbformat.h:63
static void Append(WriteBatch *dst, const WriteBatch *src)
Definition: write_batch.cc:141
static Status InsertInto(const WriteBatch *batch, MemTable *memtable)
Definition: write_batch.cc:128
static SequenceNumber Sequence(const WriteBatch *batch)
Definition: write_batch.cc:90
static int Count(const WriteBatch *batch)
Definition: write_batch.cc:82
static size_t ByteSize(const WriteBatch *batch)
static void SetCount(WriteBatch *batch, int n)
Definition: write_batch.cc:86
std::string rep_
Definition: write_batch.h:57