]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cephfs-mirror: filesystem specification class
authorVenky Shankar <vshankar@redhat.com>
Thu, 18 Jun 2020 04:22:41 +0000 (00:22 -0400)
committerVenky Shankar <vshankar@redhat.com>
Tue, 1 Sep 2020 10:58:10 +0000 (06:58 -0400)
Signed-off-by: Venky Shankar <vshankar@redhat.com>
src/tools/cephfs_mirror/Types.cc [new file with mode: 0644]
src/tools/cephfs_mirror/Types.h [new file with mode: 0644]

diff --git a/src/tools/cephfs_mirror/Types.cc b/src/tools/cephfs_mirror/Types.cc
new file mode 100644 (file)
index 0000000..1d2e2d1
--- /dev/null
@@ -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 (file)
index 0000000..cf05891
--- /dev/null
@@ -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 <set>
+#include <iostream>
+#include <string_view>
+
+#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<librados::Rados> RadosRef;
+typedef std::shared_ptr<librados::IoCtx> IoCtxRef;
+
+} // namespace mirror
+} // namespace cephfs
+
+#endif // CEPHFS_MIRROR_TYPES_H