ASSERT_EQ(0, m_test_rados->ioctx_create(m_temp_pool_name.c_str(), m_local_io_ctx));
m_temp_volume_name = "test_volume";
m_ceph_context = reinterpret_cast<CephContext*>(m_test_rados->cct());
- m_object_cache_store = new ObjectCacheStore(m_ceph_context, nullptr);
+ m_object_cache_store = new ObjectCacheStore(m_ceph_context);
}
void init_object_cache_store(std::string pool_name, std::string vol_name, uint64_t vol_size, bool reset) {
add_library(ceph_immutable_object_cache_lib STATIC ${ceph_immutable_object_cache_files})
add_executable(ceph-immutable-object-cache
- ObjectCacheFile.cc
- ObjectCacheStore.cc
- CacheController.cc
- CacheServer.cc
- CacheSession.cc
- SimplePolicy.cc
- Utils.cc
- Types.cc
main.cc)
target_link_libraries(ceph-immutable-object-cache
+ ceph_immutable_object_cache_lib
librados-cxx
stdc++fs
global)
int CacheController::init() {
ldout(m_cct, 20) << dendl;
- m_object_cache_store = new ObjectCacheStore(m_cct, pcache_op_work_queue);
+ m_object_cache_store = new ObjectCacheStore(m_cct);
//TODO(): make this configurable
int r = m_object_cache_store->init(true);
if (r < 0) {
lderr(m_cct) << "init error\n" << dendl;
+ return r;
}
+
+ r = m_object_cache_store->init_cache();
+ if (r < 0) {
+ lderr(m_cct) << "init error\n" << dendl;
+ }
+
return r;
}
switch (req->m_head.type) {
case RBDSC_REGISTER: {
- // init cache layout for volume
- m_object_cache_store->init_cache();
+ // TODO(): skip register and allow clients to lookup directly
req->m_head.type = RBDSC_REGISTER_REPLY;
m_cache_server->send(session_id, req);
std::vector<const char*> m_args;
CephContext *m_cct;
ObjectCacheStore *m_object_cache_store;
- ContextWQ* pcache_op_work_queue;
};
} // namespace immutable_obj_cache
namespace ceph {
namespace immutable_obj_cache {
-ObjectCacheStore::ObjectCacheStore(CephContext *cct, ContextWQ* work_queue)
- : m_cct(cct), m_work_queue(work_queue), m_rados(new librados::Rados()),
+ObjectCacheStore::ObjectCacheStore(CephContext *cct)
+ : m_cct(cct), m_rados(new librados::Rados()),
m_ioctxs_lock("ceph::cache::ObjectCacheStore::m_ioctxs_lock") {
object_cache_max_size =
class ObjectCacheStore
{
public:
- ObjectCacheStore(CephContext *cct, ContextWQ* work_queue);
+ ObjectCacheStore(CephContext *cct);
~ObjectCacheStore();
int init(bool reset);
int shutdown();
int do_evict(std::string cache_file);
CephContext *m_cct;
- ContextWQ* m_work_queue;
RadosRef m_rados;
std::map<uint64_t, librados::IoCtx*> m_ioctxs;
Mutex m_ioctxs_lock;