o->src_cmpxattr(oid, CEPH_NOSNAP, name, bl, op, CEPH_OSD_CMPXATTR_MODE_U64);
}
-void librados::ObjectReadOperation::stat()
+ void librados::ObjectOperation::exec(const char *cls, const char *method, bufferlist& inbl)
+ {
+ ::ObjectOperation *o = (::ObjectOperation *)impl;
+ o->call(cls, method, inbl);
+ }
+
+void librados::ObjectReadOperation::stat(uint64_t *psize, int *prval)
{
::ObjectOperation *o = (::ObjectOperation *)impl;
- o->add_op(CEPH_OSD_OP_STAT);
+ o->stat(psize, NULL, prval);
}
-void librados::ObjectReadOperation::read(size_t off, uint64_t len)
+void librados::ObjectReadOperation::read(size_t off, uint64_t len, bufferlist *pbl, int *prval)
{
::ObjectOperation *o = (::ObjectOperation *)impl;
- o->read(off, len);
+ o->read(off, len, pbl, prval);
}
-void librados::ObjectReadOperation::getxattr(const char *name)
+void librados::ObjectReadOperation::getxattr(const char *name, bufferlist *pbl, int *prval)
{
::ObjectOperation *o = (::ObjectOperation *)impl;
- o->getxattr(name);
+ o->getxattr(name, pbl, prval);
}
-void librados::ObjectReadOperation::getxattrs()
+void librados::ObjectReadOperation::getxattrs(map<string, bufferlist> *pattrs, int *prval)
{
::ObjectOperation *o = (::ObjectOperation *)impl;
- o->getxattrs();
+ o->getxattrs(pattrs, prval);
}
void librados::ObjectWriteOperation::create(bool exclusive)
if (ret < 0)
return ret;
- // decode and return the header
- bufferlist::iterator map_iter = ops[0].outdata.begin();
- ::decode(*outbl, map_iter);
+ try {
+ //decode and return the header
- bufferlist::iterator map_iter = full_map.begin();
++ bufferlist::iterator map_iter = ops[0].outdata.begin();
+ ::decode(*outbl, map_iter);
+ } catch (buffer::error& e) {
+ return -EINVAL;
+ }
return 0;
}
int cls_cxx_map_read_key(cls_method_context_t hctx, string key, bufferlist *outbl)
string next_key;
bufferlist next_val;
__u32 nkeys;
- bufferlist::iterator map_iter = full_map.begin();
+ bufferlist::iterator map_iter = ops[0].outdata.begin();
- ::decode(header, map_iter);
- ::decode(nkeys, map_iter);
- while (nkeys) {
- ::decode(next_key, map_iter);
- ::decode(next_val, map_iter);
- if (next_key == key) {
- *outbl = next_val;
- return 0;
+ try {
+ ::decode(header, map_iter);
+ ::decode(nkeys, map_iter);
+ while (nkeys) {
+ ::decode(next_key, map_iter);
+ ::decode(next_val, map_iter);
+ if (next_key == key) {
+ *outbl = next_val;
+ return 0;
+ }
+ if (next_key > key)
+ return -ENOENT;
+ --nkeys;
}
- if (next_key > key)
- return -ENOENT;
- --nkeys;
+ } catch (buffer::error& e) {
+ return -EINVAL;
}
return -ENOENT;
}
if (r < 0)
return r;
- op.read(ofs, size);
+ op.read(ofs, size, &bl, NULL);
- r = io_ctx.operate(oid, &op, &bl);
+ r = io_ctx.operate(oid, &op, NULL);
if (r == -ECANCELED) {
/* a race! object was replaced, we need to set attr on the original obj */
- dout(0) << "RGWRados::get_obj: raced with another process, going to the shadow obj instead" << dendl;
+ dout(0) << "NOTICE: RGWRados::get_obj: raced with another process, going to the shadow obj instead" << dendl;
string loc = obj.loc();
rgw_obj shadow(obj.bucket, astate->shadow_obj, loc, shadow_ns);
r = read(NULL, shadow, ofs, size, bl);