Coverage Report

Created: 2026-03-31 07:51

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/src/rocksdb/utilities/merge_operators/uint64add.h
Line
Count
Source
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
// A 'model' merge operator with uint64 addition semantics
7
// Implemented as an AssociativeMergeOperator for simplicity and example.
8
9
#pragma once
10
11
#include "rocksdb/merge_operator.h"
12
#include "utilities/merge_operators.h"
13
14
namespace ROCKSDB_NAMESPACE {
15
class Logger;
16
class Slice;
17
18
class UInt64AddOperator : public AssociativeMergeOperator {
19
 public:
20
2
  static const char* kClassName() { return "UInt64AddOperator"; }
21
2
  static const char* kNickName() { return "uint64add"; }
22
0
  const char* Name() const override { return kClassName(); }
23
0
  const char* NickName() const override { return kNickName(); }
24
25
  bool Merge(const Slice& /*key*/, const Slice* existing_value,
26
             const Slice& value, std::string* new_value,
27
             Logger* logger) const override;
28
29
 private:
30
  // Takes the string and decodes it into a uint64_t
31
  // On error, prints a message and returns 0
32
  uint64_t DecodeInteger(const Slice& value, Logger* logger) const;
33
};
34
35
}  // namespace ROCKSDB_NAMESPACE