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 <duarte@scylladb.com>
Message-Id: <20161211172037.16496-1-duarte@scylladb.com>
This commit is contained in:
Duarte Nunes
2016-12-11 18:20:37 +01:00
committed by Avi Kivity
parent bb66b051ed
commit ada2f1092e
2 changed files with 1 additions and 16 deletions

View File

@@ -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);

View File

@@ -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.
*/