donghao526 commented on code in PR #3268:
URL: https://github.com/apache/kvrocks/pull/3268#discussion_r2554486471
##########
src/types/redis_tdigest.h:
##########
@@ -33,6 +33,115 @@
#include "tdigest.h"
namespace redis {
+
+// TODO: It should be replaced by a iteration of the rocksdb iterator
+template <bool Reverse>
+class DummyCentroids {
+ public:
+ DummyCentroids(const TDigestMetadata& meta_data, const
std::vector<Centroid>& centroids)
+ : meta_data_(meta_data), centroids_(centroids) {}
+ class Iterator {
+ public:
+ using IterType = std::conditional_t<Reverse,
std::vector<Centroid>::const_reverse_iterator,
+ std::vector<Centroid>::const_iterator>;
+
+ Iterator(IterType iter, const std::vector<Centroid>& centroids) :
iter_(iter), centroids_(centroids) {}
+ std::unique_ptr<Iterator> Clone() const {
+ if constexpr (Reverse) {
+ if (iter_ != centroids_.crend()) {
Review Comment:
Good suggestion, I will refactor it.
Thanks!😊
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]