From d06e4506167b2d3fc29b5eba19c8a3a3bb34f293 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pawe=C5=82=20Dziepak?= Date: Fri, 14 Aug 2015 16:05:50 +0200 Subject: [PATCH] dht: add i_paritioner::token_to_bytes() MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows token::_data to be in a different representation than the one expected by the token type. Signed-off-by: Paweł Dziepak --- dht/i_partitioner.hh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/dht/i_partitioner.hh b/dht/i_partitioner.hh index fa8fc1edd6..463c2bb7b4 100644 --- a/dht/i_partitioner.hh +++ b/dht/i_partitioner.hh @@ -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.