diff --git a/src/include/homeobject/pg_manager.hpp b/src/include/homeobject/pg_manager.hpp index f7757c5b..bddfc68c 100644 --- a/src/include/homeobject/pg_manager.hpp +++ b/src/include/homeobject/pg_manager.hpp @@ -1,4 +1,5 @@ #pragma once +#include #include #include @@ -17,6 +18,10 @@ struct PGMember { peer_id id; std::string name; int32_t priority{0}; // <0 (Arbiter), ==0 (Follower), >0 (F|Leader) + + auto operator<=>(PGMember const& rhs) const { + return boost::uuids::hash_value(id) <=> boost::uuids::hash_value(rhs.id); + } }; using MemberSet = std::set< PGMember >; @@ -25,6 +30,8 @@ struct PGInfo { explicit PGInfo(pg_id _id) : id(_id) {} pg_id id; mutable MemberSet members; + + auto operator<=>(PGInfo const& rhs) const { return id <=> rhs.id; } }; class PGManager : public Manager< PGError > { @@ -33,7 +40,4 @@ class PGManager : public Manager< PGError > { virtual NullAsyncResult replace_member(pg_id id, peer_id const& old_member, PGMember const& new_member) = 0; }; -inline bool operator<(homeobject::PGMember const& lhs, homeobject::PGMember const& rhs) { return lhs.id < rhs.id; } -inline bool operator<(homeobject::PGInfo const& lhs, homeobject::PGInfo const& rhs) { return lhs.id < rhs.id; } - } // namespace homeobject diff --git a/src/include/homeobject/shard_manager.hpp b/src/include/homeobject/shard_manager.hpp index b4705862..ac59b6c0 100644 --- a/src/include/homeobject/shard_manager.hpp +++ b/src/include/homeobject/shard_manager.hpp @@ -1,4 +1,5 @@ #pragma once +#include #include #include @@ -26,6 +27,8 @@ struct ShardInfo { uint64_t total_capacity_bytes; uint64_t deleted_capacity_bytes; std::optional< peer_id > current_leader{std::nullopt}; + + auto operator<=>(ShardInfo const& rhs) const { return id <=> rhs.id; } }; using InfoList = std::list< ShardInfo >; diff --git a/src/lib/blob_route.hpp b/src/lib/blob_route.hpp index b691f4ec..720e17a3 100644 --- a/src/lib/blob_route.hpp +++ b/src/lib/blob_route.hpp @@ -1,3 +1,4 @@ +#include #include #include diff --git a/src/lib/homeobject_impl.hpp b/src/lib/homeobject_impl.hpp index 9847ad59..ce72cfd7 100644 --- a/src/lib/homeobject_impl.hpp +++ b/src/lib/homeobject_impl.hpp @@ -19,9 +19,6 @@ constexpr size_t shard_mask = std::numeric_limits< homeobject::shard_id >::max() inline shard_id make_new_shard_id(pg_id pg, shard_id next_shard) { return ((uint64_t)pg << shard_width) | next_shard; } -inline bool operator<(ShardInfo const& lhs, ShardInfo const& rhs) { return lhs.id < rhs.id; } -inline bool operator==(ShardInfo const& lhs, ShardInfo const& rhs) { return lhs.id == rhs.id; } - struct Shard { explicit Shard(ShardInfo info) : info(std::move(info)) {} ShardInfo info;