mirror of
https://github.com/scylladb/scylladb.git
synced 2026-06-01 04:26:48 +00:00
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:
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user