diff options
| author | jacqueline <me@jacqueline.id.au> | 2023-03-08 11:35:54 +1100 |
|---|---|---|
| committer | jacqueline <me@jacqueline.id.au> | 2023-03-08 11:35:54 +1100 |
| commit | 4887f3789817f87bf1272af0b52684e3364270c2 (patch) | |
| tree | 945eb707ab4a0f6f0a6632dbb732dcc2ee2b39a8 /lib/leveldb/db/write_batch_internal.h | |
| parent | d01f1bee1082840fdf50aa7ddd36dbcbff286d7e (diff) | |
| download | tangara-fw-4887f3789817f87bf1272af0b52684e3364270c2.tar.gz | |
add leveldb
Diffstat (limited to 'lib/leveldb/db/write_batch_internal.h')
| -rw-r--r-- | lib/leveldb/db/write_batch_internal.h | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/lib/leveldb/db/write_batch_internal.h b/lib/leveldb/db/write_batch_internal.h new file mode 100644 index 00000000..fce86e3f --- /dev/null +++ b/lib/leveldb/db/write_batch_internal.h @@ -0,0 +1,45 @@ +// 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 "db/dbformat.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 sequence number for the start of this batch. + static SequenceNumber Sequence(const WriteBatch* batch); + + // Store the specified number as the sequence 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_ |
