From ada2f1092ee2b3fbd81a445e8fa2b2e34d5fe2dd Mon Sep 17 00:00:00 2001 From: Duarte Nunes Date: Sun, 11 Dec 2016 18:20:37 +0100 Subject: [PATCH] dht: Make i_partitioner::tri_compare pure virtual This patch makes the i_partitioner::tri_compare() function pure virtual as it is overridden by all partitioners. Signed-off-by: Duarte Nunes Message-Id: <20161211172037.16496-1-duarte@scylladb.com> --- dht/i_partitioner.cc | 15 --------------- dht/i_partitioner.hh | 2 +- 2 files changed, 1 insertion(+), 16 deletions(-) diff --git a/dht/i_partitioner.cc b/dht/i_partitioner.cc index 688c411088..166ec1ea2e 100644 --- a/dht/i_partitioner.cc +++ b/dht/i_partitioner.cc @@ -112,21 +112,6 @@ static inline unsigned char get_byte(bytes_view b, size_t off) { } } -int i_partitioner::tri_compare(const token& t1, const token& t2) const { - size_t sz = std::min(t1._data.size(), t2._data.size()); - - for (size_t i = 0; i < sz; i++) { - auto b1 = get_byte(t1._data, i); - auto b2 = get_byte(t2._data, i); - if (b1 < b2) { - return -1; - } else if (b1 > b2) { - return 1; - } - } - return 0; -} - int tri_compare(const token& t1, const token& t2) { if (t1._kind == t2._kind) { return global_partitioner().tri_compare(t1, t2); diff --git a/dht/i_partitioner.hh b/dht/i_partitioner.hh index af8e9dcf53..89dde67ded 100644 --- a/dht/i_partitioner.hh +++ b/dht/i_partitioner.hh @@ -284,7 +284,7 @@ public: /** * @return < 0 if if t1's _data array is less, t2's. 0 if they are equal, and > 0 otherwise. _kind comparison should be done separately. */ - virtual int tri_compare(const token& t1, const token& t2) const; + virtual int tri_compare(const token& t1, const token& t2) const = 0; /** * @return true if t1's _data array is equal t2's. _kind comparison should be done separately. */