diff --git a/locator/tablets.hh b/locator/tablets.hh index b40df63b59..9032645e00 100644 --- a/locator/tablets.hh +++ b/locator/tablets.hh @@ -45,21 +45,6 @@ struct tablet_id { bool operator<=>(const tablet_id&) const = default; }; -} - -namespace std { - -template<> -struct hash { - size_t operator()(const locator::tablet_id& id) const { - return std::hash()(id.value()); - } -}; - -} - -namespace locator { - /// Identifies tablet (not be confused with tablet replica) in the scope of the whole cluster. struct global_tablet_id { table_id table; @@ -80,6 +65,39 @@ std::ostream& operator<<(std::ostream&, const tablet_replica&); using tablet_replica_set = utils::small_vector; +} + +namespace std { + +template<> +struct hash { + size_t operator()(const locator::tablet_id& id) const { + return std::hash()(id.value()); + } +}; + +template<> +struct hash { + size_t operator()(const locator::tablet_replica& r) const { + return utils::hash_combine( + std::hash()(r.host), + std::hash()(r.shard)); + } +}; + +template<> +struct hash { + size_t operator()(const locator::global_tablet_id& id) const { + return utils::hash_combine( + std::hash()(id.table), + std::hash()(id.tablet)); + } +}; + +} + +namespace locator { + /// Creates a new replica set with old_replica replaced by new_replica. /// If there is no old_replica, the set is returned unchanged. inline @@ -309,28 +327,6 @@ public: } -namespace std { - -template<> -struct hash { - size_t operator()(const locator::tablet_replica& r) const { - return utils::hash_combine( - std::hash()(r.host), - std::hash()(r.shard)); - } -}; - -template<> -struct hash { - size_t operator()(const locator::global_tablet_id& id) const { - return utils::hash_combine( - std::hash()(id.table), - std::hash()(id.tablet)); - } -}; - -} - template <> struct fmt::formatter : fmt::formatter { auto format(const locator::tablet_transition_stage&, fmt::format_context& ctx) const -> decltype(ctx.out());