Skip to content

Commit

Permalink
objclass: add cls_cxx_map_remove_range()
Browse files Browse the repository at this point in the history
Fixes: http://tracker.ceph.com/issues/19975

Signed-off-by: Casey Bodley <[email protected]>
  • Loading branch information
cbodley committed Aug 6, 2019
1 parent e8c320f commit d2fcef9
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
17 changes: 17 additions & 0 deletions src/objclass/class_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -622,6 +622,23 @@ int cls_cxx_map_remove_key(cls_method_context_t hctx, const string &key)
return (*pctx)->pg->do_osd_ops(*pctx, ops);
}

int cls_cxx_map_remove_range(cls_method_context_t hctx,
const std::string& key_begin,
const std::string& key_end)
{
PrimaryLogPG::OpContext **pctx = (PrimaryLogPG::OpContext **)hctx;
vector<OSDOp> ops(1);
OSDOp& op = ops[0];
bufferlist& update_bl = op.indata;

::encode(key_begin, update_bl);
::encode(key_end, update_bl);

op.op.op = CEPH_OSD_OP_OMAPRMKEYRANGE;

return (*pctx)->pg->do_osd_ops(*pctx, ops);
}

int cls_cxx_list_watchers(cls_method_context_t hctx,
obj_list_watch_response_t *watchers)
{
Expand Down
4 changes: 4 additions & 0 deletions src/objclass/objclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,10 @@ extern int cls_cxx_map_set_vals(cls_method_context_t hctx,
const std::map<std::string, ceph::buffer::list> *map);
extern int cls_cxx_map_write_header(cls_method_context_t hctx, ceph::buffer::list *inbl);
extern int cls_cxx_map_remove_key(cls_method_context_t hctx, const std::string &key);
/* remove keys in the range [key_begin, key_end) */
extern int cls_cxx_map_remove_range(cls_method_context_t hctx,
const std::string& key_begin,
const std::string& key_end);
extern int cls_cxx_map_update(cls_method_context_t hctx, ceph::buffer::list *inbl);

extern int cls_cxx_list_watchers(cls_method_context_t hctx,
Expand Down

0 comments on commit d2fcef9

Please sign in to comment.