]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
cls/refcount: add chunk_refcount_client() 19935/head
authormyoungwon oh <omwmw@sk.com>
Mon, 19 Mar 2018 07:20:18 +0000 (16:20 +0900)
committermyoungwon oh <omwmw@sk.com>
Fri, 13 Apr 2018 17:36:16 +0000 (02:36 +0900)
Signed-off-by: Myoungwon Oh <omwmw@sk.com>
src/cls/refcount/cls_refcount_client.cc

index 14da2ff2b316f5c79e245348563ab272b688e127..d3e1aeecb4700c46507ed442c8bb3b4040685c2c 100644 (file)
@@ -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;
+}