fork of https://github.com/oxigraph/rocksdb and https://github.com/facebook/rocksdb for nextgraph and oxigraph
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.
32 lines
759 B
32 lines
759 B
12 years ago
|
/**
|
||
|
* 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 MergeOperator {
|
||
|
public:
|
||
|
|
||
|
StringAppendOperator(char delim_char); /// Constructor: specify delimiter
|
||
|
|
||
|
virtual void 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
|
||
|
|