forked from vesoft-inc/nebula
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support custom compactionFilter and mergeOperator in rocksdb engine (v…
- Loading branch information
Showing
10 changed files
with
150 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
/* Copyright (c) 2018 - present, VE Software Inc. All rights reserved | ||
* | ||
* This source code is licensed under Apache 2.0 License | ||
* (found in the LICENSE.Apache file in the root directory) | ||
*/ | ||
|
||
#ifndef STORAGE_COMPACTIONFILTER_H_ | ||
#define STORAGE_COMPACTIONFILTER_H_ | ||
|
||
#include "base/Base.h" | ||
#include <rocksdb/compaction_filter.h> | ||
|
||
namespace nebula { | ||
namespace storage { | ||
|
||
class NebulaCompactionFilterFactory final : public rocksdb::CompactionFilterFactory { | ||
public: | ||
std::unique_ptr<rocksdb::CompactionFilter> | ||
CreateCompactionFilter(const rocksdb::CompactionFilter::Context& context) override { | ||
return std::make_unique<NebulaCompactionFilter>(); | ||
} | ||
|
||
const char* Name() const override { | ||
return "NebulaCompactionFilterFactory"; | ||
} | ||
}; | ||
|
||
class NebulaCompactionFilter final : public rocksdb::CompactionFilter { | ||
public: | ||
bool Filter(int level, const rocksdb::Slice& key, const rocksdb::Slice& old_val, | ||
std::string* new_val, bool* value_changed) const override { | ||
return false; | ||
} | ||
|
||
const char* Name() const override { | ||
return "NebulaCompactionFilter"; | ||
} | ||
}; | ||
|
||
} // namespace storage | ||
} // namespace nebula | ||
#endif // STORAGE_COMPACTIONFILTER_H_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* Copyright (c) 2018 - present, VE Software Inc. All rights reserved | ||
* | ||
* This source code is licensed under Apache 2.0 License | ||
* (found in the LICENSE.Apache file in the root directory) | ||
*/ | ||
|
||
#ifndef KVSTORE_MERGEOPERATOR_H_ | ||
#define KVSTORE_MERGEOPERATOR_H_ | ||
|
||
#include "base/Base.h" | ||
#include <rocksdb/merge_operator.h> | ||
|
||
namespace nebula { | ||
namespace kvstore { | ||
|
||
class NebulaOperator : public rocksdb::MergeOperator { | ||
public: | ||
const char* Name() const override { | ||
return "NebulaOperator"; | ||
} | ||
|
||
private: | ||
// Default implementations of the MergeOperator functions | ||
bool FullMergeV2(const MergeOperationInput& merge_in, | ||
MergeOperationOutput* merge_out) const override { | ||
LOG(FATAL) << "NOT Implement!"; | ||
return false; | ||
} | ||
|
||
bool PartialMerge(const Slice& key, const Slice& left_operand, | ||
const Slice& right_operand, std::string* new_value, | ||
Logger* logger) const override { | ||
LOG(FATL) << "NOT implement!"; | ||
return false; | ||
} | ||
}; | ||
|
||
|
||
} // namespace kvstore | ||
} // namespace nebula | ||
#endif // KVSTORE_MERGEOPERATOR_H_ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters