]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
tools: clean up data structure of immutable obj cache daemon
authorYuan Zhou <yuan.zhou@intel.com>
Thu, 28 Feb 2019 08:51:41 +0000 (16:51 +0800)
committerYuan Zhou <yuan.zhou@intel.com>
Thu, 21 Mar 2019 16:16:30 +0000 (00:16 +0800)
Signed-off-by: Yuan Zhou <yuan.zhou@intel.com>
src/test/immutable_object_cache/test_DomainSocket.cc
src/test/immutable_object_cache/test_message.cc
src/tools/immutable_object_cache/CacheClient.cc
src/tools/immutable_object_cache/CacheController.cc
src/tools/immutable_object_cache/Types.cc
src/tools/immutable_object_cache/Types.h

index af6b7f91fe5340af6cfaf020d4334211efd88bf2..0b6720e9ad32cdd6b1893afdd341059214cec00e 100644 (file)
@@ -88,10 +88,10 @@ public:
       case RBDSC_READ: {
         ObjectCacheReadData* read_req = (ObjectCacheReadData*)req;
         ObjectCacheRequest* reply = nullptr;
-        if (m_hit_entry_set.find(read_req->m_oid) == m_hit_entry_set.end()) {
+        if (m_hit_entry_set.find(read_req->oid) == m_hit_entry_set.end()) {
           reply = new ObjectCacheReadRadosData(RBDSC_READ_RADOS, req->seq);
         } else {
-          reply = new ObjectCacheReadReplyData(RBDSC_READ_REPLY, req->seq, "/temp/cache/path");
+          reply = new ObjectCacheReadReplyData(RBDSC_READ_REPLY, req->seq, "/fakepath");
         }
         m_cache_server->send(session_id, reply);
         break;
index 0d3a31f23b87c5ba8d3b8105a8846a81f22f1e50..b03fa35313d28f0ed58176dc45c04065e9ccccd8 100644 (file)
@@ -36,12 +36,12 @@ TEST(test_for_message, test_1)
   ASSERT_EQ(req_decode->seq, 123456UL);
   ASSERT_EQ(((ObjectCacheReadData*)req_decode)->type, RBDSC_READ);
   ASSERT_EQ(((ObjectCacheReadData*)req_decode)->seq, 123456UL);
-  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->m_read_offset, 222222UL);
-  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->m_read_len, 333333UL);
-  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->m_pool_id, 444444UL);
-  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->m_snap_id, 555555UL);
-  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->m_pool_namespace, pool_nspace);
-  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->m_oid, oid_name);
+  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->read_offset, 222222UL);
+  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->read_len, 333333UL);
+  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->pool_id, 444444UL);
+  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->snap_id, 555555UL);
+  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->pool_namespace, pool_nspace);
+  ASSERT_EQ(((ObjectCacheReadData*)req_decode)->oid, oid_name);
 
   delete req;
   delete req_decode;
index e2ab8e6c0394ebda30a0b729764869af1ec19d2a..ba226dd34cf1aab643d8fc535885027ce79412b4 100644 (file)
@@ -90,7 +90,7 @@ namespace immutable_obj_cache {
 
     ObjectCacheRequest* req = new ObjectCacheReadData(RBDSC_READ, ++m_sequence_id, 0, 0,
                                                       pool_id, snap_id, oid, pool_nspace);
-    req->m_process_msg = on_finish;
+    req->process_msg = on_finish;
     req->encode();
 
     {
@@ -251,7 +251,7 @@ namespace immutable_obj_cache {
        if (dedicated) {
          // dedicated thrad to execute this context.
        }
-       current_request->m_process_msg->complete(reply);
+       current_request->process_msg->complete(reply);
        delete current_request;
        delete reply;
     });
@@ -326,7 +326,7 @@ namespace immutable_obj_cache {
       Mutex::Locker locker(m_lock);
       for (auto it : m_seq_to_req) {
         it.second->type = RBDSC_READ_RADOS;
-        it.second->m_process_msg->complete(it.second);
+        it.second->process_msg->complete(it.second);
       }
       m_seq_to_req.clear();
     }
index 319631d34635289a1333fe5a9628677317736a54..7648a3a6d05d2e1eb0c42c4a045a2a3d35d07909 100644 (file)
@@ -95,10 +95,10 @@ void CacheController::handle_request(uint64_t session_id, ObjectCacheRequest* re
       // lookup object in local cache store
       std::string cache_path;
       ObjectCacheReadData* req_read_data = (ObjectCacheReadData*)req;
-      int ret = m_object_cache_store->lookup_object(req_read_data->m_pool_namespace,
-                                                    req_read_data->m_pool_id,
-                                                    req_read_data->m_snap_id,
-                                                    req_read_data->m_oid,
+      int ret = m_object_cache_store->lookup_object(req_read_data->pool_namespace,
+                                                    req_read_data->pool_id,
+                                                    req_read_data->snap_id,
+                                                    req_read_data->oid,
                                                     cache_path);
       ObjectCacheRequest* reply = nullptr;
       if (ret != OBJ_CACHE_PROMOTED) {
index 2e547b11b5e0d0989d8996243b8f145c083bbe62..beb63c3e4ef68375c223cbcd5072247e26f3519d 100644 (file)
@@ -17,13 +17,13 @@ ObjectCacheRequest::ObjectCacheRequest(uint16_t t, uint64_t s)
 ObjectCacheRequest::~ObjectCacheRequest(){}
 
 void ObjectCacheRequest::encode() {
-  ENCODE_START(1, 1, m_payload);
-  ceph::encode(type, m_payload);
-  ceph::encode(seq, m_payload);
+  ENCODE_START(1, 1, payload);
+  ceph::encode(type, payload);
+  ceph::encode(seq, payload);
   if (!payload_empty()) {
     encode_payload();
   }
-  ENCODE_FINISH(m_payload);
+  ENCODE_FINISH(payload);
 }
 
 void ObjectCacheRequest::decode(bufferlist& bl) {
@@ -61,9 +61,9 @@ ObjectCacheReadData::ObjectCacheReadData(uint16_t t, uint64_t s,
                                          uint64_t read_offset, uint64_t read_len,
                                          uint64_t pool_id, uint64_t snap_id,
                                          std::string oid, std::string pool_namespace)
-  : ObjectCacheRequest(t, s), m_read_offset(read_offset),
-    m_read_len(read_len), m_pool_id(pool_id), m_snap_id(snap_id),
-    m_oid(oid), m_pool_namespace(pool_namespace)
+  : ObjectCacheRequest(t, s), read_offset(read_offset),
+    read_len(read_len), pool_id(pool_id), snap_id(snap_id),
+    oid(oid), pool_namespace(pool_namespace)
 {}
 
 ObjectCacheReadData::ObjectCacheReadData(uint16_t t, uint64_t s)
@@ -72,36 +72,36 @@ ObjectCacheReadData::ObjectCacheReadData(uint16_t t, uint64_t s)
 ObjectCacheReadData::~ObjectCacheReadData() {}
 
 void ObjectCacheReadData::encode_payload() {
-  ceph::encode(m_read_offset, m_payload);
-  ceph::encode(m_read_len, m_payload);
-  ceph::encode(m_pool_id, m_payload);
-  ceph::encode(m_snap_id, m_payload);
-  ceph::encode(m_oid, m_payload);
-  ceph::encode(m_pool_namespace, m_payload);
+  ceph::encode(read_offset, payload);
+  ceph::encode(read_len, payload);
+  ceph::encode(pool_id, payload);
+  ceph::encode(snap_id, payload);
+  ceph::encode(oid, payload);
+  ceph::encode(pool_namespace, payload);
 }
 
 void ObjectCacheReadData::decode_payload(bufferlist::const_iterator i) {
-  ceph::decode(m_read_offset, i);
-  ceph::decode(m_read_len, i);
-  ceph::decode(m_pool_id, i);
-  ceph::decode(m_snap_id, i);
-  ceph::decode(m_oid, i);
-  ceph::decode(m_pool_namespace, i);
+  ceph::decode(read_offset, i);
+  ceph::decode(read_len, i);
+  ceph::decode(pool_id, i);
+  ceph::decode(snap_id, i);
+  ceph::decode(oid, i);
+  ceph::decode(pool_namespace, i);
 }
 
 ObjectCacheReadReplyData::ObjectCacheReadReplyData(uint16_t t, uint64_t s, string cache_path)
-  : ObjectCacheRequest(t, s), m_cache_path(cache_path) {}
+  : ObjectCacheRequest(t, s), cache_path(cache_path) {}
 ObjectCacheReadReplyData::ObjectCacheReadReplyData(uint16_t t, uint64_t s)
   : ObjectCacheRequest(t, s) {}
 
 ObjectCacheReadReplyData::~ObjectCacheReadReplyData() {}
 
 void ObjectCacheReadReplyData::encode_payload() {
-  ceph::encode(m_cache_path, m_payload);
+  ceph::encode(cache_path, payload);
 }
 
 void ObjectCacheReadReplyData::decode_payload(bufferlist::const_iterator i) {
-  ceph::decode(m_cache_path, i);
+  ceph::decode(cache_path, i);
 }
 
 ObjectCacheReadRadosData::ObjectCacheReadRadosData() {}
index 99b7b8ae97fb151b50841fac684cb98fd474878e..6518d13ea4dc5cb3a970e906c4bd2c1c733315a5 100644 (file)
@@ -33,9 +33,9 @@ public:
   uint16_t type;
   uint64_t seq;
 
-  bufferlist m_payload;
+  bufferlist payload;
 
-  GenContext<ObjectCacheRequest*>* m_process_msg;
+  GenContext<ObjectCacheRequest*>* process_msg;
 
   ObjectCacheRequest();
   ObjectCacheRequest(uint16_t type, uint64_t seq);
@@ -47,7 +47,7 @@ public:
   //          be encoded which be implements by child class.
   void encode();
   void decode(bufferlist& bl);
-  bufferlist get_payload_bufferlist() { return m_payload; }
+  bufferlist get_payload_bufferlist() { return payload; }
 
   virtual void encode_payload() = 0;
   virtual void decode_payload(bufferlist::const_iterator bl_it) = 0;
@@ -79,12 +79,12 @@ public:
 
 class ObjectCacheReadData : public ObjectCacheRequest {
 public:
-  uint64_t m_read_offset;
-  uint64_t m_read_len;
-  uint64_t m_pool_id;
-  uint64_t m_snap_id;
-  std::string m_oid;
-  std::string m_pool_namespace;
+  uint64_t read_offset;
+  uint64_t read_len;
+  uint64_t pool_id;
+  uint64_t snap_id;
+  std::string oid;
+  std::string pool_namespace;
   ObjectCacheReadData(uint16_t t, uint64_t s, uint64_t read_offset, uint64_t read_len, uint64_t pool_id,
                       uint64_t snap_id, std::string oid, std::string pool_namespace );
   ObjectCacheReadData(uint16_t t, uint64_t s);
@@ -97,7 +97,7 @@ public:
 
 class ObjectCacheReadReplyData : public ObjectCacheRequest {
 public:
-  std::string m_cache_path;
+  std::string cache_path;
   ObjectCacheReadReplyData(uint16_t t, uint64_t s, std::string cache_path);
   ObjectCacheReadReplyData(uint16_t t, uint64_t s);
   ~ObjectCacheReadReplyData() override;