]>
Commit | Line | Data |
---|---|---|
1e59de90 TL |
1 | // Copyright (c) 2017-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 | #pragma once | |
7 | #include <algorithm> | |
8 | #include <cstddef> | |
9 | #include <memory> | |
10 | #include <unordered_map> | |
11 | ||
12 | #include "rocksdb/merge_operator.h" | |
13 | #include "rocksdb/slice.h" | |
14 | #include "rocksdb/utilities/agg_merge.h" | |
15 | #include "utilities/cassandra/cassandra_options.h" | |
16 | ||
17 | namespace ROCKSDB_NAMESPACE { | |
18 | class SumAggregator : public Aggregator { | |
19 | public: | |
20 | ~SumAggregator() override {} | |
21 | bool Aggregate(const std::vector<Slice>&, std::string& result) const override; | |
22 | bool DoPartialAggregate() const override { return true; } | |
23 | }; | |
24 | ||
25 | class MultipleAggregator : public Aggregator { | |
26 | public: | |
27 | ~MultipleAggregator() override {} | |
28 | bool Aggregate(const std::vector<Slice>&, std::string& result) const override; | |
29 | bool DoPartialAggregate() const override { return true; } | |
30 | }; | |
31 | ||
32 | class Last3Aggregator : public Aggregator { | |
33 | public: | |
34 | ~Last3Aggregator() override {} | |
35 | bool Aggregate(const std::vector<Slice>&, std::string& result) const override; | |
36 | }; | |
37 | ||
38 | class EncodeHelper { | |
39 | public: | |
40 | static std::string EncodeFuncAndInt(const Slice& function_name, | |
41 | int64_t value); | |
42 | static std::string EncodeInt(int64_t value); | |
43 | static std::string EncodeList(const std::vector<Slice>& list); | |
44 | static std::string EncodeFuncAndList(const Slice& function_name, | |
45 | const std::vector<Slice>& list); | |
46 | }; | |
47 | } // namespace ROCKSDB_NAMESPACE |