1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#include <errno.h>
#include "cls/cas/cls_cas_client.h"
#include "cls/cas/cls_cas_ops.h"
#include "include/rados/librados.hpp"
using std::set;
using std::string;
using ceph::bufferlist;
using ceph::decode;
using ceph::encode;
void cls_cas_chunk_create_or_get_ref(
librados::ObjectWriteOperation& op,
const hobject_t& soid,
const bufferlist& data,
bool verify)
{
bufferlist in;
cls_cas_chunk_create_or_get_ref_op call;
call.source = soid;
if (verify) {
call.flags |= cls_cas_chunk_create_or_get_ref_op::FLAG_VERIFY;
}
call.data = data;
encode(call, in);
op.exec("cas", "chunk_create_or_get_ref", in);
}
void cls_cas_chunk_get_ref(
librados::ObjectWriteOperation& op,
const hobject_t& soid)
{
bufferlist in;
cls_cas_chunk_get_ref_op call;
call.source = soid;
encode(call, in);
op.exec("cas", "chunk_get_ref", in);
}
void cls_cas_chunk_put_ref(
librados::ObjectWriteOperation& op,
const hobject_t& soid)
{
bufferlist in;
cls_cas_chunk_put_ref_op call;
call.source = soid;
encode(call, in);
op.exec("cas", "chunk_put_ref", in);
}
int cls_cas_references_chunk(
librados::IoCtx& io_ctx,
const string& oid,
const string& chunk_oid)
{
bufferlist in, out;
encode(chunk_oid, in);
int r = io_ctx.exec(oid, "cas", "references_chunk", in, out);
return r;
}
|