LevelDB project 1 10225501460 林子骥 10211900416 郭夏辉
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 lines
1.5 KiB

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