小组成员:10215300402-朱维清 & 10222140408 谷杰
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

45 rivejä
1.4 KiB

  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. #ifndef STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
  5. #define STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_
  6. #include "leveldb/write_batch.h"
  7. namespace leveldb {
  8. // WriteBatchInternal provides static methods for manipulating a
  9. // WriteBatch that we don't want in the public WriteBatch interface.
  10. class WriteBatchInternal {
  11. public:
  12. // Return the number of entries in the batch.
  13. static int Count(const WriteBatch* batch);
  14. // Set the count for the number of entries in the batch.
  15. static void SetCount(WriteBatch* batch, int n);
  16. // Return the seqeunce number for the start of this batch.
  17. static SequenceNumber Sequence(const WriteBatch* batch);
  18. // Store the specified number as the seqeunce number for the start of
  19. // this batch.
  20. static void SetSequence(WriteBatch* batch, SequenceNumber seq);
  21. static Slice Contents(const WriteBatch* batch) {
  22. return Slice(batch->rep_);
  23. }
  24. static size_t ByteSize(const WriteBatch* batch) {
  25. return batch->rep_.size();
  26. }
  27. static void SetContents(WriteBatch* batch, const Slice& contents);
  28. static Status InsertInto(const WriteBatch* batch, MemTable* memtable);
  29. };
  30. }
  31. #endif // STORAGE_LEVELDB_DB_WRITE_BATCH_INTERNAL_H_