dht: add i_paritioner::token_to_bytes()

This allows token::_data to be in a different representation
than the one expected by the token type.

Signed-off-by: Paweł Dziepak <pdziepak@cloudius-systems.com>
This commit is contained in:
Paweł Dziepak
2015-08-14 16:05:50 +02:00
parent faa588cb0a
commit d06e450616

View File

@@ -231,6 +231,13 @@ public:
* Calculates the shard that handles a particular token.
*/
virtual unsigned shard_of(const token& t) const = 0;
/**
* @return bytes that represent the token as required by get_token_validator().
*/
virtual bytes token_to_bytes(const token& t) const {
return bytes(t._data.begin(), t._data.end());
}
protected:
/**
* @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.