}
TestMemIoCtxImpl::TestMemIoCtxImpl(const TestMemIoCtxImpl& rhs)
- : TestIoCtxImpl(rhs), m_client(rhs.m_client), m_pool(rhs.m_pool) {
- }
+ : TestIoCtxImpl(rhs), m_client(rhs.m_client), m_pool(rhs.m_pool) {
+ m_pool->get();
+}
TestMemIoCtxImpl::TestMemIoCtxImpl(TestMemRadosClient &client, int64_t pool_id,
const std::string& pool_name,
TestMemRadosClient::Pool *pool)
- : TestIoCtxImpl(client, pool_id, pool_name), m_client(&client), m_pool(pool) {
- }
+ : TestIoCtxImpl(client, pool_id, pool_name), m_client(&client),
+ m_pool(pool) {
+ m_pool->get();
+}
+
+TestMemIoCtxImpl::~TestMemIoCtxImpl() {
+ m_pool->put();
+}
TestIoCtxImpl *TestMemIoCtxImpl::clone() {
return new TestMemIoCtxImpl(*this);
class TestMemIoCtxImpl : public TestIoCtxImpl {
public:
TestMemIoCtxImpl();
- explicit TestMemIoCtxImpl(TestMemRadosClient &client, int64_t m_pool_id,
- const std::string& pool_name,
- TestMemRadosClient::Pool *pool);
+ TestMemIoCtxImpl(TestMemRadosClient &client, int64_t m_pool_id,
+ const std::string& pool_name,
+ TestMemRadosClient::Pool *pool);
+ virtual ~TestMemIoCtxImpl();
virtual TestIoCtxImpl *clone();
if (iter == m_pools.end()) {
return -ENOENT;
}
- delete iter->second;
+ iter->second->put();
m_pools.erase(iter);
return 0;
}
#include "test/librados_test_stub/TestRadosClient.h"
#include "include/atomic.h"
+#include "include/assert.h"
#include "include/buffer.h"
#include "include/interval_set.h"
+#include "common/RefCountedObj.h"
#include "common/RWLock.h"
#include <boost/shared_ptr.hpp>
#include <list>
typedef std::map<std::string, FileSnapshots> Files;
typedef std::set<uint64_t> SnapSeqs;
- struct Pool {
+ struct Pool : public RefCountedObject {
Pool();
int64_t pool_id;