]>
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/rbd/librbd.hpp"
18 typedef shared_ptr
<librados::Rados
> RadosRef
;
19 typedef shared_ptr
<librados::IoCtx
> IoCtxRef
;
20 typedef shared_ptr
<librbd::Image
> ImageRef
;
23 std::string global_id
;
26 explicit ImageId(const std::string
&global_id
) : global_id(global_id
) {
28 ImageId(const std::string
&global_id
, const std::string
&id
)
29 : global_id(global_id
), id(id
) {
32 inline bool operator==(const ImageId
&rhs
) const {
33 return (global_id
== rhs
.global_id
&& id
== rhs
.id
);
35 inline bool operator<(const ImageId
&rhs
) const {
36 return global_id
< rhs
.global_id
;
40 std::ostream
&operator<<(std::ostream
&, const ImageId
&image_id
);
42 typedef std::set
<ImageId
> ImageIds
;
46 peer_t(const std::string
&uuid
, const std::string
&cluster_name
,
47 const std::string
&client_name
)
48 : uuid(uuid
), cluster_name(cluster_name
), client_name(client_name
)
51 peer_t(const librbd::mirror_peer_t
&peer
) :
53 cluster_name(peer
.cluster_name
),
54 client_name(peer
.client_name
)
58 std::string cluster_name
;
59 std::string client_name
;
60 bool operator<(const peer_t
&rhs
) const {
61 return this->uuid
< rhs
.uuid
;
63 bool operator()(const peer_t
&lhs
, const peer_t
&rhs
) const {
64 return lhs
.uuid
< rhs
.uuid
;
66 bool operator==(const peer_t
&rhs
) const {
67 return uuid
== rhs
.uuid
;
71 std::ostream
& operator<<(std::ostream
& lhs
, const peer_t
&peer
);
77 #endif // CEPH_RBD_MIRROR_TYPES_H