From bd1cd53b2a85fa073244efef0a48b24b0d176dae Mon Sep 17 00:00:00 2001 From: Asias He Date: Mon, 12 Dec 2016 16:18:37 +0800 Subject: [PATCH] repair: Add hash specialization for partition_checksum So we can store partition_checksum in std::map as key. --- repair/repair.hh | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/repair/repair.hh b/repair/repair.hh index 55b586a597..7b42dc0308 100644 --- a/repair/repair.hh +++ b/repair/repair.hh @@ -108,3 +108,14 @@ public: future checksum_range(seastar::sharded &db, const sstring& keyspace, const sstring& cf, const ::nonwrapping_range& range, repair_checksum rt); + +namespace std { +template<> +struct hash { + size_t operator()(partition_checksum sum) const { + size_t h = 0; + std::copy_n(sum.digest().begin(), std::min(sizeof(size_t), sizeof(sum.digest())), reinterpret_cast(&h)); + return h; + } +}; +}