On Sun, Mar 3, 2013 at 5:08 PM, Noah Watkins <jayhawk@xxxxxxxxxxx> wrote: > > I've built a custom protocol on top of Rados::exec that uses serialized > versions of InputObject and OutputObject to implement the protocol. Here's > simple pseudo-code that provides my_service::exec: > > void my_service::exec(oid, input_params, bufferlist& out) { > bufferlist inbl, outbl; > InputObject in(input_params); > ::encode(in, inbl); > > librados::exec(oid, inbl, outbl); > > OutputObject reply; > ::decode(reply, outbl); > out = reply.payload; > } > > I'd like to provide a my_service::aio_exec that wraps librados::aio_exec, > but doing so doesn't seem to be straight-forward with the current async > interface. > > Notice in the above example that the callers output bufferlist must be > unpacked from the reply protocol. However, the librados::aio_exec interface > unpacks the output directly into the caller parameter: > > int librados::aio_exec(oid, …, bufferlist *outbl) > { > ... > objecter->read(oid, oloc, rd, snap_seq, outbl, 0, onack, &c->objver); > } > > What's needed is a intermediate bufferlist that can be decoded when the > data is available. > > One way to do this would be wrap AioCompletion and intercept ack and safe > callbacks to do the data unpacking. The problem with this is that we have to > introduce a new AioCompletion type, or new AioCompletionImpl. I started to > do this, but it feels quite clunky. > > Any suggestions for handling this? > I pushed the wip-librados-exec branch last week that solves a similar issue. I added two more ObjectOperation::exec() api calls. The more interesting one added a callback context that is called with the output buffer of the completed sub-op. Currently in order to use it you'll need to use operate()/aio_operate(), however, a similar aio_exec interface can be added. Yehuda -- To unsubscribe from this list: send the line "unsubscribe ceph-devel" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html