27 static const size_t kHeader = 12;
44 if (input.
size() < kHeader) {
51 while (!input.
empty()) {
59 handler->
Put(key, value);
117 virtual void Put(
const Slice& key,
const Slice&
value) {
121 virtual void Delete(
const Slice& key) {
130 MemTableInserter inserter;
132 inserter.mem_ = memtable;
137 assert(contents.
size() >= kHeader);
142 SetCount(dst, Count(dst) + Count(src));
143 assert(src->
rep_.size() >= kHeader);
144 dst->
rep_.append(src->
rep_.data() + kHeader, src->
rep_.size() - kHeader);
virtual void Put(const Slice &key, const Slice &value)=0
static void SetContents(WriteBatch *batch, const Slice &contents)
uint64_t DecodeFixed64(const char *ptr)
const char * data() const
virtual void Delete(const Slice &key)=0
static Status Corruption(const Slice &msg, const Slice &msg2=Slice())
void EncodeFixed32(char *buf, uint32_t value)
static void SetSequence(WriteBatch *batch, SequenceNumber seq)
uint32_t DecodeFixed32(const char *ptr)
void Delete(const Slice &key)
void remove_prefix(size_t n)
void EncodeFixed64(char *buf, uint64_t value)
void PutLengthPrefixedSlice(std::string *dst, const Slice &value)
static void Append(WriteBatch *dst, const WriteBatch *src)
Status Iterate(Handler *handler) const
static Status InsertInto(const WriteBatch *batch, MemTable *memtable)
static SequenceNumber Sequence(const WriteBatch *batch)
static int Count(const WriteBatch *batch)
const char * GetLengthPrefixedSlice(const char *p, const char *limit, Slice *result)
static void SetCount(WriteBatch *batch, int n)
void Put(const Slice &key, const Slice &value)