From: Jason Dillaman Date: Mon, 10 Sep 2018 16:44:54 +0000 (-0400) Subject: rbd-mirror: renamed 'peer_t' type to 'PeerSpec' X-Git-Tag: v14.0.1~288^2~7 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=672bb2c6b8e71cf5b867ce51c2538090c50dcc87;p=ceph.git rbd-mirror: renamed 'peer_t' type to 'PeerSpec' Signed-off-by: Jason Dillaman --- diff --git a/src/test/rbd_mirror/test_ClusterWatcher.cc b/src/test/rbd_mirror/test_ClusterWatcher.cc index 02e4baa357576..0300bc183959b 100644 --- a/src/test/rbd_mirror/test_ClusterWatcher.cc +++ b/src/test/rbd_mirror/test_ClusterWatcher.cc @@ -19,7 +19,7 @@ #include using rbd::mirror::ClusterWatcher; -using rbd::mirror::peer_t; +using rbd::mirror::PeerSpec; using rbd::mirror::RadosRef; using std::map; using std::set; @@ -59,7 +59,7 @@ public: TestFixture::TearDown(); } - void create_pool(bool enable_mirroring, const peer_t &peer, + void create_pool(bool enable_mirroring, const PeerSpec &peer, string *uuid = nullptr, string *name=nullptr) { string pool_name = get_temp_pool_name("test-rbd-mirror-"); ASSERT_EQ(0, m_cluster->pool_create(pool_name.c_str())); @@ -89,7 +89,7 @@ public: } } - void delete_pool(const string &name, const peer_t &peer) { + void delete_pool(const string &name, const PeerSpec &peer) { int64_t pool_id = m_cluster->pool_lookup(name.c_str()); ASSERT_GE(pool_id, 0); if (m_pool_peers.find(pool_id) != m_pool_peers.end()) { @@ -159,26 +159,26 @@ TEST_F(TestClusterWatcher, NoPools) { TEST_F(TestClusterWatcher, NoMirroredPools) { check_peers(); - create_pool(false, peer_t()); + create_pool(false, PeerSpec()); check_peers(); - create_pool(false, peer_t()); + create_pool(false, PeerSpec()); check_peers(); - create_pool(false, peer_t()); + create_pool(false, PeerSpec()); check_peers(); } TEST_F(TestClusterWatcher, ReplicatedPools) { - peer_t site1("", "site1", "mirror1"); - peer_t site2("", "site2", "mirror2"); + PeerSpec site1("", "site1", "mirror1"); + PeerSpec site2("", "site2", "mirror2"); string first_pool, last_pool; check_peers(); create_pool(true, site1, &site1.uuid, &first_pool); check_peers(); - create_pool(false, peer_t()); + create_pool(false, PeerSpec()); check_peers(); - create_pool(false, peer_t()); + create_pool(false, PeerSpec()); check_peers(); - create_pool(false, peer_t()); + create_pool(false, PeerSpec()); check_peers(); create_pool(true, site2, &site2.uuid); check_peers(); @@ -193,7 +193,7 @@ TEST_F(TestClusterWatcher, ReplicatedPools) { } TEST_F(TestClusterWatcher, CachePools) { - peer_t site1("", "site1", "mirror1"); + PeerSpec site1("", "site1", "mirror1"); string base1, base2, cache1, cache2; create_pool(true, site1, &site1.uuid, &base1); check_peers(); @@ -204,7 +204,7 @@ TEST_F(TestClusterWatcher, CachePools) { } BOOST_SCOPE_EXIT_END; check_peers(); - create_pool(false, peer_t(), nullptr, &base2); + create_pool(false, PeerSpec(), nullptr, &base2); create_cache_pool(base2, &cache2); BOOST_SCOPE_EXIT( base2, cache2, this_ ) { this_->remove_cache_pool(base2, cache2); diff --git a/src/test/rbd_mirror/test_PoolWatcher.cc b/src/test/rbd_mirror/test_PoolWatcher.cc index f43d0ed0a0073..1f31f177337e6 100644 --- a/src/test/rbd_mirror/test_PoolWatcher.cc +++ b/src/test/rbd_mirror/test_PoolWatcher.cc @@ -33,7 +33,7 @@ using rbd::mirror::ImageId; using rbd::mirror::ImageIds; using rbd::mirror::PoolWatcher; -using rbd::mirror::peer_t; +using rbd::mirror::PeerSpec; using rbd::mirror::RadosRef; using std::map; using std::set; @@ -88,7 +88,7 @@ public: } }; - void create_pool(bool enable_mirroring, const peer_t &peer, string *name=nullptr) { + void create_pool(bool enable_mirroring, const PeerSpec &peer, string *name=nullptr) { string pool_name = get_temp_pool_name("test-rbd-mirror-"); ASSERT_EQ(0, m_cluster->pool_create(pool_name.c_str())); @@ -229,14 +229,14 @@ public: TEST_F(TestPoolWatcher, EmptyPool) { string uuid1 = "00000000-0000-0000-0000-000000000001"; - peer_t site1(uuid1, "site1", "mirror1"); + PeerSpec site1(uuid1, "site1", "mirror1"); create_pool(true, site1); check_images(); } TEST_F(TestPoolWatcher, ReplicatedPools) { string uuid1 = "00000000-0000-0000-0000-000000000001"; - peer_t site1(uuid1, "site1", "mirror1"); + PeerSpec site1(uuid1, "site1", "mirror1"); string first_pool, local_pool, last_pool; create_pool(true, site1, &first_pool); check_images(); diff --git a/src/tools/rbd_mirror/ClusterWatcher.h b/src/tools/rbd_mirror/ClusterWatcher.h index e0de653dd75c1..7080a1c6a9991 100644 --- a/src/tools/rbd_mirror/ClusterWatcher.h +++ b/src/tools/rbd_mirror/ClusterWatcher.h @@ -29,7 +29,7 @@ template class ServiceDaemon; */ class ClusterWatcher { public: - typedef std::set Peers; + typedef std::set Peers; typedef std::map PoolPeers; typedef std::set PoolNames; diff --git a/src/tools/rbd_mirror/Mirror.h b/src/tools/rbd_mirror/Mirror.h index fd04cddaa512e..153c0bc52a337 100644 --- a/src/tools/rbd_mirror/Mirror.h +++ b/src/tools/rbd_mirror/Mirror.h @@ -51,7 +51,7 @@ public: private: typedef ClusterWatcher::PoolPeers PoolPeers; - typedef std::pair PoolPeer; + typedef std::pair PoolPeer; void update_pool_replayers(const PoolPeers &pool_peers); diff --git a/src/tools/rbd_mirror/PoolReplayer.cc b/src/tools/rbd_mirror/PoolReplayer.cc index e64f87370c076..ffdebde4039cf 100644 --- a/src/tools/rbd_mirror/PoolReplayer.cc +++ b/src/tools/rbd_mirror/PoolReplayer.cc @@ -227,7 +227,7 @@ private: template PoolReplayer::PoolReplayer(Threads *threads, ServiceDaemon* service_daemon, - int64_t local_pool_id, const peer_t &peer, + int64_t local_pool_id, const PeerSpec &peer, const std::vector &args) : m_threads(threads), m_service_daemon(service_daemon), diff --git a/src/tools/rbd_mirror/PoolReplayer.h b/src/tools/rbd_mirror/PoolReplayer.h index 9ecb16bc30c73..bcd428749cb74 100644 --- a/src/tools/rbd_mirror/PoolReplayer.h +++ b/src/tools/rbd_mirror/PoolReplayer.h @@ -48,7 +48,7 @@ class PoolReplayer { public: PoolReplayer(Threads *threads, ServiceDaemon* service_daemon, - int64_t local_pool_id, const peer_t &peer, + int64_t local_pool_id, const PeerSpec &peer, const std::vector &args); ~PoolReplayer(); PoolReplayer(const PoolReplayer&) = delete; @@ -211,7 +211,7 @@ private: Threads *m_threads; ServiceDaemon* m_service_daemon; int64_t m_local_pool_id = -1; - peer_t m_peer; + PeerSpec m_peer; std::vector m_args; mutable Mutex m_lock; diff --git a/src/tools/rbd_mirror/Types.cc b/src/tools/rbd_mirror/Types.cc index f4abb1fae61a0..74fe318ebcae5 100644 --- a/src/tools/rbd_mirror/Types.cc +++ b/src/tools/rbd_mirror/Types.cc @@ -11,7 +11,7 @@ std::ostream &operator<<(std::ostream &os, const ImageId &image_id) { << "id=" << image_id.id; } -std::ostream& operator<<(std::ostream& lhs, const peer_t &peer) { +std::ostream& operator<<(std::ostream& lhs, const PeerSpec &peer) { return lhs << "uuid: " << peer.uuid << " cluster: " << peer.cluster_name << " client: " << peer.client_name; diff --git a/src/tools/rbd_mirror/Types.h b/src/tools/rbd_mirror/Types.h index 41920b7bb4ff8..6fbd95f4ee1b8 100644 --- a/src/tools/rbd_mirror/Types.h +++ b/src/tools/rbd_mirror/Types.h @@ -61,34 +61,33 @@ struct Peer { typedef std::set Peers; -struct peer_t { - peer_t() = default; - peer_t(const std::string &uuid, const std::string &cluster_name, - const std::string &client_name) +struct PeerSpec { + PeerSpec() = default; + PeerSpec(const std::string &uuid, const std::string &cluster_name, + const std::string &client_name) : uuid(uuid), cluster_name(cluster_name), client_name(client_name) { } - peer_t(const librbd::mirror_peer_t &peer) : + PeerSpec(const librbd::mirror_peer_t &peer) : uuid(peer.uuid), cluster_name(peer.cluster_name), client_name(peer.client_name) { } + std::string uuid; std::string cluster_name; std::string client_name; - bool operator<(const peer_t &rhs) const { - return this->uuid < rhs.uuid; - } - bool operator()(const peer_t &lhs, const peer_t &rhs) const { - return lhs.uuid < rhs.uuid; + + bool operator<(const PeerSpec &rhs) const { + return uuid < rhs.uuid; } - bool operator==(const peer_t &rhs) const { + bool operator==(const PeerSpec &rhs) const { return uuid == rhs.uuid; } }; -std::ostream& operator<<(std::ostream& lhs, const peer_t &peer); +std::ostream& operator<<(std::ostream& lhs, const PeerSpec &peer); } // namespace mirror } // namespace rbd