1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
3 #include "rados_backend.h"
4 #include <boost/tuple/tuple.hpp>
6 typedef boost::tuple<Context*, Context*, librados::AioCompletion*> arg_type;
8 void on_applied(void *completion, void *_arg) {
9 arg_type *arg = static_cast<arg_type*>(_arg);
10 arg->get<1>()->complete(0);
13 void on_complete(void *completion, void *_arg) {
14 arg_type *arg = static_cast<arg_type*>(_arg);
15 arg->get<0>()->complete(0);
16 arg->get<2>()->release();
20 void RadosBackend::write(
24 Context *on_write_applied,
27 librados::AioCompletion *completion = librados::Rados::aio_create_completion();
30 void *arg = static_cast<void *>(new arg_type(on_commit, on_write_applied,
33 completion->set_safe_callback(
37 completion->set_complete_callback(
41 ioctx->aio_write(oid, completion, bl, bl.length(), offset);
44 void RadosBackend::read(
49 Context *on_read_complete)
51 librados::AioCompletion *completion = librados::Rados::aio_create_completion();
54 void *arg = static_cast<void *>(new arg_type(on_read_complete, 0,
57 completion->set_complete_callback(
61 ioctx->aio_read(oid, completion, bl, length, offset);