summaryrefslogtreecommitdiffstats
path: root/src/osd/osd_op_util.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 18:45:59 +0000
commit19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch)
tree42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /src/osd/osd_op_util.h
parentInitial commit. (diff)
downloadceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.tar.xz
ceph-19fcec84d8d7d21e796c7624e521b60d28ee21ed.zip
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/osd/osd_op_util.h')
-rw-r--r--src/osd/osd_op_util.h83
1 files changed, 83 insertions, 0 deletions
diff --git a/src/osd/osd_op_util.h b/src/osd/osd_op_util.h
new file mode 100644
index 000000000..5fb568e40
--- /dev/null
+++ b/src/osd/osd_op_util.h
@@ -0,0 +1,83 @@
+// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
+// vim: ts=8 sw=2 smarttab
+
+#pragma once
+
+#include <vector>
+#include <string>
+
+#include "osd/OSDMap.h"
+
+#include "messages/MOSDOp.h"
+
+class OpInfo {
+public:
+ struct ClassInfo {
+ ClassInfo(std::string&& class_name, std::string&& method_name,
+ bool read, bool write, bool allowed) :
+ class_name(std::move(class_name)), method_name(std::move(method_name)),
+ read(read), write(write), allowed(allowed)
+ {}
+ const std::string class_name;
+ const std::string method_name;
+ const bool read, write, allowed;
+ };
+
+private:
+ uint64_t rmw_flags = 0;
+ std::vector<ClassInfo> classes;
+
+ void set_rmw_flags(int flags);
+
+ void add_class(std::string&& class_name, std::string&& method_name,
+ bool read, bool write, bool allowed) {
+ classes.emplace_back(std::move(class_name), std::move(method_name),
+ read, write, allowed);
+ }
+
+public:
+
+ void clear() {
+ rmw_flags = 0;
+ }
+
+ uint64_t get_flags() const {
+ return rmw_flags;
+ }
+
+ bool check_rmw(int flag) const ;
+ bool may_read() const;
+ bool may_write() const;
+ bool may_cache() const;
+ bool rwordered_forced() const;
+ bool rwordered() const;
+ bool includes_pg_op() const;
+ bool need_read_cap() const;
+ bool need_write_cap() const;
+ bool need_promote() const;
+ bool need_skip_handle_cache() const;
+ bool need_skip_promote() const;
+ bool allows_returnvec() const;
+
+ void set_read();
+ void set_write();
+ void set_cache();
+ void set_class_read();
+ void set_class_write();
+ void set_pg_op();
+ void set_promote();
+ void set_skip_handle_cache();
+ void set_skip_promote();
+ void set_force_rwordered();
+ void set_returnvec();
+
+ int set_from_op(
+ const MOSDOp *m,
+ const OSDMap &osdmap);
+
+ std::vector<ClassInfo> get_classes() const {
+ return classes;
+ }
+};
+
+std::ostream& operator<<(std::ostream& out, const OpInfo::ClassInfo& i);