From: Venky Shankar Date: Thu, 18 Jun 2020 04:22:41 +0000 (-0400) Subject: cephfs-mirror: filesystem specification class X-Git-Tag: v16.1.0~1247^2~10 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=26114bffee0a7de80d8f23b0e43b09e4580122e0;p=ceph.git cephfs-mirror: filesystem specification class Signed-off-by: Venky Shankar --- diff --git a/src/tools/cephfs_mirror/Types.cc b/src/tools/cephfs_mirror/Types.cc new file mode 100644 index 00000000000..1d2e2d1e592 --- /dev/null +++ b/src/tools/cephfs_mirror/Types.cc @@ -0,0 +1,16 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#include "Types.h" + +namespace cephfs { +namespace mirror { + +std::ostream& operator<<(std::ostream& out, const FilesystemSpec &spec) { + out << "{fs_name=" << spec.fs_name << ", pool_id=" << spec.pool_id << "}"; + return out; +} + +} // namespace mirror +} // namespace cephfs + diff --git a/src/tools/cephfs_mirror/Types.h b/src/tools/cephfs_mirror/Types.h new file mode 100644 index 00000000000..cf05891db6a --- /dev/null +++ b/src/tools/cephfs_mirror/Types.h @@ -0,0 +1,51 @@ +// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- +// vim: ts=8 sw=2 smarttab + +#ifndef CEPHFS_MIRROR_TYPES_H +#define CEPHFS_MIRROR_TYPES_H + +#include +#include +#include + +#include "include/rados/librados.hpp" + +namespace cephfs { +namespace mirror { + +static const std::string CEPHFS_MIRROR_OBJECT("cephfs_mirror"); + +// specification of a filesystem -- pool id the metadata pool id. +struct FilesystemSpec { + FilesystemSpec() = default; + FilesystemSpec(std::string_view fs_name, uint64_t pool_id) + : fs_name(fs_name), + pool_id(pool_id) { + } + + std::string fs_name; + uint64_t pool_id; + + bool operator==(const FilesystemSpec &rhs) const { + return (fs_name == rhs.fs_name && + pool_id == rhs.pool_id); + } + + bool operator<(const FilesystemSpec &rhs) const { + if (fs_name != rhs.fs_name) { + return fs_name < rhs.fs_name; + } + + return pool_id < rhs.pool_id; + } +}; + +std::ostream& operator<<(std::ostream& out, const FilesystemSpec &spec); + +typedef std::shared_ptr RadosRef; +typedef std::shared_ptr IoCtxRef; + +} // namespace mirror +} // namespace cephfs + +#endif // CEPHFS_MIRROR_TYPES_H