diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-27 18:24:20 +0000 |
commit | 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 (patch) | |
tree | e5d88d25d870d5dedacb6bbdbe2a966086a0a5cf /src/cls/lua/cls_lua_client.cc | |
parent | Initial commit. (diff) | |
download | ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.tar.xz ceph-483eb2f56657e8e7f419ab1a4fab8dce9ade8609.zip |
Adding upstream version 14.2.21.upstream/14.2.21upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/cls/lua/cls_lua_client.cc')
-rw-r--r-- | src/cls/lua/cls_lua_client.cc | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/cls/lua/cls_lua_client.cc b/src/cls/lua/cls_lua_client.cc new file mode 100644 index 00000000..0e6544a2 --- /dev/null +++ b/src/cls/lua/cls_lua_client.cc @@ -0,0 +1,34 @@ +#include <string> +#include <vector> +#include "include/encoding.h" +#include "include/rados/librados.hpp" // for IoCtx +#include "cls_lua_client.h" +#include "cls_lua_ops.h" + +using std::string; +using std::vector; +using librados::IoCtx; +using librados::bufferlist; + +namespace cls_lua_client { + /* + * Currently the return code and return bufferlist are not wrapped in a + * protocol that allows object class vs Lua to be distinguished. For + * instance, -EOPNOTSUPP might refer to cls_lua not being found, but would + * also be returned when cls_lua is found, but a Lua handler is not found. + */ + int exec(IoCtx& ioctx, const string& oid, const string& script, + const string& handler, bufferlist& input, bufferlist& output) + { + cls_lua_eval_op op; + + op.script = script; + op.handler = handler; + op.input = input; + + bufferlist inbl; + encode(op, inbl); + + return ioctx.exec(oid, "lua", "eval_bufferlist", inbl, output); + } +} |