class OSDOp;
namespace crimson::osd {
+
+// PgOpsExecuter -- a class for executing ops targeting a certain object.
class OpsExecuter {
using call_errorator = crimson::errorator<
crimson::stateful_ec,
return std::forward<Func>(f)(backend, obc->obs, txn);
}
- // PG operations are being provided with pg instead of os.
- template <class Func>
- auto do_pg_op(Func&& f) {
- return std::forward<Func>(f)(std::as_const(pg),
- std::as_const(msg->get_hobj().nspace));
- }
-
decltype(auto) dont_do_legacy_op() {
return crimson::ct_error::operation_not_supported::make();
}
backend(pg.get_backend()),
msg(std::move(msg)) {
}
- OpsExecuter(PG& pg, Ref<MOSDOp> msg)
- : OpsExecuter{ObjectContextRef(), nullptr, pg, std::move(msg)}
- {}
osd_op_errorator::future<> execute_osd_op(class OSDOp& osd_op);
- seastar::future<> execute_pg_op(class OSDOp& osd_op);
template <typename Func, typename MutFunc>
osd_op_errorator::future<> flush_changes(Func&& func, MutFunc&& mut_func) &&;
}
}
+// PgOpsExecuter -- a class for executing ops targeting a certain PG.
+class PgOpsExecuter {
+public:
+ PgOpsExecuter(PG& pg, Ref<MOSDOp> msg)
+ : pg(pg), msg(std::move(msg)) {
+ }
+
+ seastar::future<> execute_pg_op(class OSDOp& osd_op);
+
+private:
+ // PG operations are being provided with pg instead of os.
+ template <class Func>
+ auto do_pg_op(Func&& f) {
+ return std::forward<Func>(f)(std::as_const(pg),
+ std::as_const(msg->get_hobj().nspace));
+ }
+
+ PG& pg;
+ Ref<MOSDOp> msg;
+};
+
} // namespace crimson::osd
throw crimson::common::system_shutdown_exception();
}
- auto ox = std::make_unique<OpsExecuter>(*this/* as const& */, m);
+ auto ox = std::make_unique<PgOpsExecuter>(*this/* as const& */, m);
return seastar::do_for_each(m->ops, [ox = ox.get()](OSDOp& osd_op) {
logger().debug("will be handling pg op {}", ceph_osd_op_name(osd_op.op.op));
return ox->execute_pg_op(osd_op);