Skip to content

Commit

Permalink
cls/refcount: add chunk_refcount_client()
Browse files Browse the repository at this point in the history
Signed-off-by: Myoungwon Oh <omwmw@sk.com>
  • Loading branch information
myoungwon committed Apr 13, 2018
1 parent 3ff9bd4 commit 5d67bb9
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions src/cls/refcount/cls_refcount_client.cc
Original file line number Diff line number Diff line change
Expand Up @@ -58,3 +58,50 @@ int cls_refcount_read(librados::IoCtx& io_ctx, string& oid, list<string> *refs,

return r;
}

void cls_chunk_refcount_get(librados::ObjectWriteOperation& op, const hobject_t& soid)
{
bufferlist in;
cls_chunk_refcount_get_op call;
call.source = soid;
encode(call, in);
op.exec("refcount", "chunk_get", in);
}

void cls_chunk_refcount_put(librados::ObjectWriteOperation& op, const hobject_t& soid)
{
bufferlist in;
cls_chunk_refcount_put_op call;
call.source = soid;
encode(call, in);
op.exec("refcount", "chunk_put", in);
}

void cls_chunk_refcount_set(librados::ObjectWriteOperation& op, set<hobject_t>& refs)
{
bufferlist in;
cls_chunk_refcount_set_op call;
call.refs = refs;
encode(call, in);
op.exec("refcount", "chunk_set", in);
}

int cls_chunk_refcount_read(librados::IoCtx& io_ctx, string& oid, set<hobject_t> *refs)
{
bufferlist in, out;
int r = io_ctx.exec(oid, "refcount", "chunk_read", in, out);
if (r < 0)
return r;

cls_chunk_refcount_read_ret ret;
try {
bufferlist::iterator iter = out.begin();
decode(ret, iter);
} catch (buffer::error& err) {
return -EIO;
}

*refs = ret.refs;

return r;
}

0 comments on commit 5d67bb9

Please sign in to comment.