cct->_conf->apply_changes(NULL);
client->reset(new librados::TestMemRadosClient(cct),
&librados::TestRadosClient::Deallocate);
+ if (g_ceph_context == NULL) {
+ g_ceph_context = cct;
+ }
cct->put();
}
(*client)->get();
o->ops.push_back(op);
}
+void ObjectWriteOperation::append(const bufferlist &bl) {
+ TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
+ o->ops.push_back(boost::bind(&TestIoCtxImpl::append, _1, _2, bl, _4));
+}
+
void ObjectWriteOperation::create(bool exclusive) {
TestObjectOperationImpl *o = reinterpret_cast<TestObjectOperationImpl*>(impl);
o->ops.push_back(boost::bind(&TestIoCtxImpl::create, _1, _2, exclusive));
bufferlist *pbl);
virtual int aio_remove(const std::string& oid, AioCompletionImpl *c) = 0;
+ virtual int append(const std::string& oid, const bufferlist &bl,
+ const SnapContext &snapc) = 0;
virtual int assert_exists(const std::string &oid) = 0;
virtual int create(const std::string& oid, bool exclusive) = 0;
return 0;
}
+int TestMemIoCtxImpl::append(const std::string& oid, const bufferlist &bl,
+ const SnapContext &snapc) {
+ if (get_snap_read() != CEPH_NOSNAP) {
+ return -EROFS;
+ }
+
+ TestMemRadosClient::SharedFile file;
+ {
+ RWLock::WLocker l(m_pool->file_lock);
+ file = get_file(oid, true, snapc);
+ }
+
+ RWLock::WLocker l(file->lock);
+ file->data.append(bl);
+ return 0;
+}
+
int TestMemIoCtxImpl::assert_exists(const std::string &oid) {
RWLock::RLocker l(m_pool->file_lock);
TestMemRadosClient::SharedFile file = get_file(oid, false,
virtual int aio_remove(const std::string& oid, AioCompletionImpl *c);
+ virtual int append(const std::string& oid, const bufferlist &bl,
+ const SnapContext &snapc);
virtual int assert_exists(const std::string &oid);
virtual int create(const std::string& oid, bool exclusive);