]> git.proxmox.com Git - ceph.git/blame - ceph/src/cls/lua/cls_lua_client.cc
update sources to v12.1.0
[ceph.git] / ceph / src / cls / lua / cls_lua_client.cc
CommitLineData
7c673cae
FG
1#include <string>
2#include <vector>
3#include "include/encoding.h"
31f18b77 4#include "include/rados/librados.hpp" // for IoCtx
7c673cae
FG
5#include "cls_lua_client.h"
6#include "cls_lua_ops.h"
7
8using std::string;
9using std::vector;
10using librados::IoCtx;
11using librados::bufferlist;
12
13namespace cls_lua_client {
14 /*
15 * Currently the return code and return bufferlist are not wrapped in a
16 * protocol that allows object class vs Lua to be distinguished. For
17 * instance, -EOPNOTSUPP might refer to cls_lua not being found, but would
18 * also be returned when cls_lua is found, but a Lua handler is not found.
19 */
20 int exec(IoCtx& ioctx, const string& oid, const string& script,
21 const string& handler, bufferlist& input, bufferlist& output)
22 {
23 cls_lua_eval_op op;
24
25 op.script = script;
26 op.handler = handler;
27 op.input = input;
28
29 bufferlist inbl;
30 ::encode(op, inbl);
31
32 return ioctx.exec(oid, "lua", "eval_bufferlist", inbl, output);
33 }
34}