diff options
author | Daniel Gryniewicz <dang@redhat.com> | 2021-03-17 14:22:22 +0100 |
---|---|---|
committer | Daniel Gryniewicz <dang@redhat.com> | 2021-04-19 15:40:34 +0200 |
commit | cbbe8e8680387878bb5e7e447587891319086ada (patch) | |
tree | 8b3553696dadb70196e75081a74c1fa64236cedf /src/rgw/rgw_lua.cc | |
parent | Merge pull request #40378 from zdover23/wip-doc-cephadm-osd-declarative-state... (diff) | |
download | ceph-cbbe8e8680387878bb5e7e447587891319086ada.tar.xz ceph-cbbe8e8680387878bb5e7e447587891319086ada.zip |
RGW Zipper - Remove rgw_pool/sysobj from API
rgw_pool and sysobj are part of the RADOS backend, and do not belong in
the API. Instead, pull the objects using them into the API. These are:
RGWOIDCProvider, RGWRole, and a new object LuaScript.
Signed-off-by: Daniel Gryniewicz <dang@redhat.com>
Diffstat (limited to 'src/rgw/rgw_lua.cc')
-rw-r--r-- | src/rgw/rgw_lua.cc | 72 |
1 files changed, 8 insertions, 64 deletions
diff --git a/src/rgw/rgw_lua.cc b/src/rgw/rgw_lua.cc index 6ad5ff04d76..384ef2787c4 100644 --- a/src/rgw/rgw_lua.cc +++ b/src/rgw/rgw_lua.cc @@ -65,79 +65,23 @@ std::string script_oid(context ctx, const std::string& tenant) { int read_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx, std::string& script) { - RGWObjVersionTracker objv_tracker; + auto lua_script = store->get_lua_script_manager(); - rgw_raw_obj obj(store->get_zone()->get_params().log_pool, script_oid(ctx, tenant)); - - bufferlist bl; - - const auto rc = store->get_system_obj( - dpp, - obj.pool, - obj.oid, - bl, - &objv_tracker, - nullptr, - y, - nullptr, - nullptr); - - if (rc < 0) { - return rc; - } - - auto iter = bl.cbegin(); - try { - ceph::decode(script, iter); - } catch (buffer::error& err) { - return -EIO; - } - - return 0; + return lua_script->get(dpp, y, script_oid(ctx, tenant), script); } -int write_script(rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script) +int write_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx, const std::string& script) { - RGWObjVersionTracker objv_tracker; - - rgw_raw_obj obj(store->get_zone()->get_params().log_pool, script_oid(ctx, tenant)); - - bufferlist bl; - ceph::encode(script, bl); + auto lua_script = store->get_lua_script_manager(); - const auto rc = store->put_system_obj( - obj.pool, - obj.oid, - bl, - false, - &objv_tracker, - real_time(), - y); - - if (rc < 0) { - return rc; - } - - return 0; + return lua_script->put(dpp, y, script_oid(ctx, tenant), script); } -int delete_script(rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx) +int delete_script(const DoutPrefixProvider *dpp, rgw::sal::Store* store, const std::string& tenant, optional_yield y, context ctx) { - RGWObjVersionTracker objv_tracker; - - rgw_raw_obj obj(store->get_zone()->get_params().log_pool, script_oid(ctx, tenant)); + auto lua_script = store->get_lua_script_manager(); - const auto rc = store->delete_system_obj( - obj.pool, - obj.oid, - &objv_tracker, - y); - - if (rc < 0 && rc != -ENOENT) { - return rc; - } - - return 0; + return lua_script->del(dpp, y, script_oid(ctx, tenant)); } #ifdef WITH_RADOSGW_LUA_PACKAGES |