e1346968d8
Summary: -Added null checks and revisions to DBIter::MergeValuesNewToOld() -Added DBIter test to stringappend_test -Major fix with Merge and TTL More plans for fixes later. Test Plan: -make clean; make stringappend_test -j 32; ./stringappend_test -make all check; Reviewers: haobo, emayanke, vamsi, dhruba Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D12315
31 lines
770 B
C++
31 lines
770 B
C++
/**
|
|
* A MergeOperator for rocksdb/leveldb that implements string append.
|
|
* @author Deon Nicholas (dnicholas@fb.com)
|
|
* Copyright 2013 Facebook
|
|
*/
|
|
|
|
#include "leveldb/merge_operator.h"
|
|
#include "leveldb/slice.h"
|
|
|
|
namespace leveldb {
|
|
|
|
class StringAppendOperator : public AssociativeMergeOperator {
|
|
public:
|
|
StringAppendOperator(char delim_char); /// Constructor: specify delimiter
|
|
|
|
virtual bool Merge(const Slice& key,
|
|
const Slice* existing_value,
|
|
const Slice& value,
|
|
std::string* new_value,
|
|
Logger* logger) const override;
|
|
|
|
virtual const char* Name() const override;
|
|
|
|
private:
|
|
char delim_; // The delimiter is inserted between elements
|
|
|
|
};
|
|
|
|
} // namespace leveldb
|
|
|