]>
git.proxmox.com Git - ceph.git/blob - ceph/src/tools/cephfs_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 CEPHFS_MIRROR_TYPES_H
5 #define CEPHFS_MIRROR_TYPES_H
11 #include "include/rados/librados.hpp"
12 #include "include/cephfs/libcephfs.h"
13 #include "mds/mdstypes.h"
18 static const std::string
CEPHFS_MIRROR_OBJECT("cephfs_mirror");
20 typedef boost::variant
<bool, uint64_t, std::string
> AttributeValue
;
21 typedef std::map
<std::string
, AttributeValue
> Attributes
;
23 // distinct filesystem identifier
25 fs_cluster_id_t fscid
;
28 bool operator==(const Filesystem
&rhs
) const {
29 return (fscid
== rhs
.fscid
&&
30 fs_name
== rhs
.fs_name
);
33 bool operator!=(const Filesystem
&rhs
) const {
34 return !(*this == rhs
);
37 bool operator<(const Filesystem
&rhs
) const {
38 if (fscid
!= rhs
.fscid
) {
39 return fscid
< rhs
.fscid
;
42 return fs_name
< rhs
.fs_name
;
46 // specification of a filesystem -- pool id the metadata pool id.
47 struct FilesystemSpec
{
48 FilesystemSpec() = default;
49 FilesystemSpec(const Filesystem
&filesystem
, uint64_t pool_id
)
50 : filesystem(filesystem
),
53 FilesystemSpec(fs_cluster_id_t fscid
, std::string_view fs_name
, uint64_t pool_id
)
54 : filesystem(Filesystem
{fscid
, std::string(fs_name
)}),
58 Filesystem filesystem
;
61 bool operator==(const FilesystemSpec
&rhs
) const {
62 return (filesystem
== rhs
.filesystem
&&
63 pool_id
== rhs
.pool_id
);
66 bool operator<(const FilesystemSpec
&rhs
) const {
67 if (filesystem
!= rhs
.filesystem
) {
68 return filesystem
< rhs
.filesystem
;
71 return pool_id
< rhs
.pool_id
;
75 std::ostream
& operator<<(std::ostream
& out
, const Filesystem
&filesystem
);
76 std::ostream
& operator<<(std::ostream
& out
, const FilesystemSpec
&spec
);
78 typedef std::shared_ptr
<librados::Rados
> RadosRef
;
79 typedef std::shared_ptr
<librados::IoCtx
> IoCtxRef
;
81 // not a shared_ptr since the type is incomplete
82 typedef ceph_mount_info
*MountRef
;
87 #endif // CEPHFS_MIRROR_TYPES_H