}
public:
+ /**
+ * Execute an OSD class method on an object
+ *
+ * The OSD has a plugin mechanism for performing complicated
+ * operations on an object atomically. These plugins are called
+ * classes. This function allows librados users to call the custom
+ * methods. The input and output formats are defined by the class.
+ * Classes in ceph.git can be found in src/cls subdirectories
+ *
+ * This Op may be a read, so only read execs are permitted with this interface
+ *
+ * @param method the method as defined in cls/<class>/cls_<class>_ops.h
+ * @param inbl where to find input
+ * @param out (optional) where to store output
+ * @param ec (optional) storage for error code
+ * @param f (optional) handler callback
+ * @returns return code (>=0 for success, otherwise stanard OSD errors)
+ */
template <typename Tag, typename ClassID, typename... Args>
void exec(const ClsMethod<Tag, ClassID>& method, const ceph::buffer::list& inbl, Args&&... args) {
static_assert(FlagTraits<Tag>::is_readonly,
return std::move(*this);
}
+ /**
+ * Execute an OSD class method on an object
+ *
+ * The OSD has a plugin mechanism for performing complicated
+ * operations on an object atomically. These plugins are called
+ * classes. This function allows librados users to call the custom
+ * methods. The input and output formats are defined by the class.
+ * Classes in ceph.git can be found in src/cls subdirectories
+ *
+ * This is a write op, so all execs are permitted (including reads)
+ *
+ * @param method the method as defined in cls/<class>/cls_<class>_ops.h
+ * @param inbl where to find input
+ * @param out (optional) where to store output
+ * @param ec (optional) storage for error code
+ * @param f (optional) handler callback
+ * @returns return code (>=0 for success, otherwise stanard OSD errors)
+ */
template <typename Tag, typename ClassID, typename... Args>
decltype(auto) exec(const ClsMethod<Tag, ClassID>& method, const ceph::buffer::list& inbl, Args&&... args) & {
Op::exec_impl(method.cls, method.name, inbl, std::forward<Args>(args)...);
* Execute an OSD class method on an object
* See rados_exec() for general description.
*
+ * Use this for reads as well as writes. The rados_read_op_exec has been
+ * deprecated as there is no client-side checking for the chosen cls method
+ * actually being a read vs write.
+ *
* @param write_op operation to add this action to
* @param cls the name of the class
* @param method the name of the method
* invalid OSD. Reads are permitted as part of write ops. If performance is a
* concern, consider moving to the C++ interface, which provides safety.
*
+ * NOTE: At the time this function was deprecated, it was unused within the
+ * ceph code base.
+ *
* Execute an OSD class method on an object
* See rados_exec() for general description.
*
__attribute__((deprecated("Use write ops instead")));
/**
- * * Deprecated because this op does not prevent the client specifying a cls op
- * that includes a write operation. This could allow the op to be routed to
- * invalid OSD. Reads are permitted as part of write ops. If performance is a
- * concern, consider moving to the C++ interface, which provides safety.
- *
+ * Deprecated because this op does not prevent the client specifying a cls op
+ * that includes a write operation. This could allow the op to be routed to
+ * invalid OSD. Reads are permitted as part of write ops. If performance is a
+ * concern, consider moving to the C++ interface, which provides safety.
+ *
+ * NOTE: At the time this function was deprecated, it was unused within the
+ * ceph code base.
+ *
* Execute an OSD class method on an object
* See rados_exec() for general description.
*
void exec_impl(const char *cls, const char *method, bufferlist& inbl, ObjectOperationCompletion *completion);
public:
- // By default only allow READ operations. ObjectWriteOperation overrides this
- // to allow writes.
+ /**
+ * Execute an OSD class method on an object
+ * See IoCtx::exec() for general description.
+ *
+ * Add an exec to read OR write operation. Only read-only methods may be
+ * added this way. Use ObjectWriteOperation::exec() for write methods.
+ *
+ * @param method the method as defined in cls/<class>/cls_<class>_ops.h
+ * @param inbl where to find input
+ * @param obl (optional) where to store output
+ * @param prval (optional) storage for return value.
+ * @param completion (optional) completion callback.
+ */
template <typename Tag, typename ClassID, typename... Args>
void exec(const ClsMethod<Tag, ClassID>& method, Args&&... args) {
static_assert(FlagTraits<Tag>::is_readonly,
using ObjectOperation::exec; // For deprecated rw operations.
+ /**
+ * Execute an OSD class method on an object
+ * See IoCtx::exec() for general description.
+ *
+ * Add an exec to write operation. Read or Write exec methods are permitted.
+ *
+ * @param method the method as defined in cls/<class>/cls_<class>_ops.h
+ * @param inbl where to find input
+ * @param obl (optional) where to store output
+ * @param prval (optional) storage for return value.
+ * @param completion (optional) completion callback.
+ */
template <typename Tag, typename ClassID, typename... Args>
void exec(const ClsMethod<Tag, ClassID>& method, Args&&... args) {
// Read or write operations are permitted, so allow this.
int exec_rw(const std::string& oid, const char *cls, const char *method,
bufferlist& inbl, bufferlist& outbl);
public:
+ /**
+ * Execute an OSD class method on an object
+ *
+ * The OSD has a plugin mechanism for performing complicated
+ * operations on an object atomically. These plugins are called
+ * classes. This function allows librados users to call the custom
+ * methods. The input and output formats are defined by the class.
+ * Classes in ceph.git can be found in src/cls subdirectories
+ *
+ * Synchronous variant of exec. Op will be routed as read if the method
+ * is not flagged as a write.
+ *
+ * @param oid the object name
+ * @param method the method as defined in cls/<class>/cls_<class>_ops.h
+ * @param inbl where to find input
+ * @param outbl where to store output
+ * @returns return code (>=0 for success, otherwise stanard OSD errors)
+ */
template <typename Tag, typename ClassID>
int exec(const std::string& oid, const ClsMethod<Tag, ClassID>& method, bufferlist& inbl, bufferlist& outbl) {
if constexpr (FlagTraits<Tag>::is_readonly) {
bufferlist& inbl, bufferlist *outbl);
public:
+ /**
+ * Execute an OSD class method on an object
+ * See exec() for general description.
+ *
+ * Asynchronous variant of exec. Op will be routed as read if the exec
+ * method is not flagged as a write.
+ *
+ * @param oid the object name
+ * @param c aio completion
+ * @param method the method as defined in cls/<class>/cls_<class>_ops.h
+ * @param inbl where to find input
+ * @param outbl where to store output
+ */
template <typename Tag, typename ClassID>
int aio_exec(const std::string& oid, AioCompletion *c,
const ClsMethod<Tag, ClassID>& method, bufferlist& inbl, bufferlist *outbl) {