]>
git.proxmox.com Git - ceph.git/blob - ceph/src/tools/rbd_mirror/types.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab
4 #ifndef CEPH_RBD_MIRROR_TYPES_H
5 #define CEPH_RBD_MIRROR_TYPES_H
13 #include "include/rados/librados.hpp"
14 #include "include/rbd/librbd.hpp"
19 typedef shared_ptr
<librados::Rados
> RadosRef
;
20 typedef shared_ptr
<librados::IoCtx
> IoCtxRef
;
21 typedef shared_ptr
<librbd::Image
> ImageRef
;
24 std::string global_id
;
27 explicit ImageId(const std::string
&global_id
) : global_id(global_id
) {
29 ImageId(const std::string
&global_id
, const std::string
&id
)
30 : global_id(global_id
), id(id
) {
33 inline bool operator==(const ImageId
&rhs
) const {
34 return (global_id
== rhs
.global_id
&& id
== rhs
.id
);
36 inline bool operator<(const ImageId
&rhs
) const {
37 return global_id
< rhs
.global_id
;
41 std::ostream
&operator<<(std::ostream
&, const ImageId
&image_id
);
43 typedef std::set
<ImageId
> ImageIds
;
46 std::string peer_uuid
;
47 librados::IoCtx io_ctx
;
51 Peer(const std::string
&peer_uuid
) : peer_uuid(peer_uuid
) {
53 Peer(const std::string
&peer_uuid
, librados::IoCtx
& io_ctx
)
54 : peer_uuid(peer_uuid
), io_ctx(io_ctx
) {
57 inline bool operator<(const Peer
&rhs
) const {
58 return peer_uuid
< rhs
.peer_uuid
;
62 typedef std::set
<Peer
> Peers
;
66 peer_t(const std::string
&uuid
, const std::string
&cluster_name
,
67 const std::string
&client_name
)
68 : uuid(uuid
), cluster_name(cluster_name
), client_name(client_name
)
71 peer_t(const librbd::mirror_peer_t
&peer
) :
73 cluster_name(peer
.cluster_name
),
74 client_name(peer
.client_name
)
78 std::string cluster_name
;
79 std::string client_name
;
80 bool operator<(const peer_t
&rhs
) const {
81 return this->uuid
< rhs
.uuid
;
83 bool operator()(const peer_t
&lhs
, const peer_t
&rhs
) const {
84 return lhs
.uuid
< rhs
.uuid
;
86 bool operator==(const peer_t
&rhs
) const {
87 return uuid
== rhs
.uuid
;
91 std::ostream
& operator<<(std::ostream
& lhs
, const peer_t
&peer
);
97 #endif // CEPH_RBD_MIRROR_TYPES_H