mirror of
https://github.com/facebook/rocksdb.git
synced 2024-11-27 02:44:18 +00:00
4463b11cad
Summary: Migrate names of properties from 'leveldb' prefix to 'rocksdb' prefix. Test Plan: make check Reviewers: emayanke, haobo Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D13311
52 lines
1.8 KiB
C++
52 lines
1.8 KiB
C++
/**
|
|
* A TEST MergeOperator for rocksdb that implements string append.
|
|
* It is built using the MergeOperator interface rather than the simpler
|
|
* AssociativeMergeOperator interface. This is useful for testing/benchmarking.
|
|
* While the two operators are semantically the same, all production code
|
|
* should use the StringAppendOperator defined in stringappend.{h,cc}. The
|
|
* operator defined in the present file is primarily for testing.
|
|
*
|
|
* @author Deon Nicholas (dnicholas@fb.com)
|
|
* Copyright 2013 Facebook
|
|
*/
|
|
|
|
#pragma once
|
|
#include "rocksdb/merge_operator.h"
|
|
#include "rocksdb/slice.h"
|
|
|
|
namespace rocksdb {
|
|
|
|
class StringAppendTESTOperator : public MergeOperator {
|
|
public:
|
|
|
|
StringAppendTESTOperator(char delim_char); /// Constructor with delimiter
|
|
|
|
virtual bool FullMerge(const Slice& key,
|
|
const Slice* existing_value,
|
|
const std::deque<std::string>& operand_sequence,
|
|
std::string* new_value,
|
|
Logger* logger) const override;
|
|
|
|
virtual bool PartialMerge(const Slice& key,
|
|
const Slice& left_operand,
|
|
const Slice& right_operand,
|
|
std::string* new_value,
|
|
Logger* logger) const override;
|
|
|
|
virtual const char* Name() const override;
|
|
|
|
private:
|
|
// A version of PartialMerge that actually performs "partial merging".
|
|
// Use this to simulate the exact behaviour of the StringAppendOperator.
|
|
bool _AssocPartialMerge(const Slice& key,
|
|
const Slice& left_operand,
|
|
const Slice& right_operand,
|
|
std::string* new_value,
|
|
Logger* logger) const;
|
|
|
|
char delim_; // The delimiter is inserted between elements
|
|
|
|
};
|
|
|
|
} // namespace rocksdb
|