1 // Copyright (c) 2011-present, Facebook, Inc. All rights reserved.
2 // This source code is licensed under both the GPLv2 (found in the
3 // COPYING file in the root directory) and Apache 2.0 License
4 // (found in the LICENSE.Apache file in the root directory).
5
6 #ifndef ROCKSDB_LITE
7
8 #include <string>
9
10 #include "rocksdb/slice.h"
11 #include "utilities/compaction_filters/remove_emptyvalue_compactionfilter.h"
12
13 namespace ROCKSDB_NAMESPACE {
14
Name() const15 const char* RemoveEmptyValueCompactionFilter::Name() const {
16 return "RemoveEmptyValueCompactionFilter";
17 }
18
Filter(int,const Slice &,const Slice & existing_value,std::string *,bool *) const19 bool RemoveEmptyValueCompactionFilter::Filter(int /*level*/,
20 const Slice& /*key*/,
21 const Slice& existing_value,
22 std::string* /*new_value*/,
23 bool* /*value_changed*/) const {
24 // remove kv pairs that have empty values
25 return existing_value.empty();
26 }
27
28 } // namespace ROCKSDB_NAMESPACE
29 #endif // !ROCKSDB_LITE
30