utils: uuid: define appending_hash<utils::tagged_uuid<Tag>>

And simplify usage for appending_hash<counter_shard_view>
respectively.

Signed-off-by: Benny Halevy <bhalevy@scylladb.com>
This commit is contained in:
Benny Halevy
2022-08-07 15:11:57 +03:00
parent 8235cfdf7a
commit a390b8475b
2 changed files with 9 additions and 1 deletions

View File

@@ -372,7 +372,7 @@ template<>
struct appending_hash<counter_shard_view> {
template<typename Hasher>
void operator()(Hasher& h, const counter_shard_view& cshard) const {
::feed_hash(h, cshard.id().uuid());
::feed_hash(h, cshard.id());
::feed_hash(h, cshard.value());
::feed_hash(h, cshard.logical_clock());
}

View File

@@ -250,6 +250,14 @@ struct appending_hash<utils::UUID> {
}
};
template<typename Tag>
struct appending_hash<utils::tagged_uuid<Tag>> {
template<typename Hasher>
void operator()(Hasher& h, const utils::tagged_uuid<Tag>& id) const noexcept {
appending_hash<utils::UUID>{}(h, id.uuid());
}
};
namespace std {
template<>
struct hash<utils::UUID> {