]> git.apps.os.sepia.ceph.com Git - ceph.git/commitdiff
Removing dequeue operation.
authorPritha Srivastava <prsrivas@redhat.com>
Mon, 1 Jul 2019 05:24:03 +0000 (10:54 +0530)
committerPritha Srivastava <prsrivas@redhat.com>
Tue, 15 Oct 2019 17:17:38 +0000 (22:47 +0530)
Signed-off-by: Pritha Srivastava <prsrivas@redhat.com>
src/cls/queue/cls_queue.cc
src/cls/queue/cls_queue_client.cc
src/cls/queue/cls_queue_src.cc
src/cls/queue/cls_rgw_queue.cc

index 32873b89aaa24fc37f7cb0d21c3346f14d68f0aa..fd4082ad80fd24c4630e1807aff91e92e82b4e44 100644 (file)
@@ -23,7 +23,6 @@ CLS_INIT(queue)
   cls_method_handle_t h_init_queue;
   cls_method_handle_t h_get_queue_size;
   cls_method_handle_t h_enqueue;
-  cls_method_handle_t h_dequeue;
   cls_method_handle_t h_queue_list_entries;
   cls_method_handle_t h_queue_remove_entries;
   cls_method_handle_t h_queue_update_last_entry;
@@ -39,7 +38,6 @@ CLS_INIT(queue)
   cls_register_cxx_method(h_class, INIT_QUEUE, CLS_METHOD_WR, cls_init_queue, &h_init_queue);
   cls_register_cxx_method(h_class, GET_QUEUE_SIZE, CLS_METHOD_RD, cls_get_queue_size, &h_get_queue_size);
   cls_register_cxx_method(h_class, ENQUEUE, CLS_METHOD_RD | CLS_METHOD_WR, cls_enqueue, &h_enqueue);
-  cls_register_cxx_method(h_class, DEQUEUE, CLS_METHOD_RD | CLS_METHOD_WR, cls_dequeue, &h_dequeue);
   cls_register_cxx_method(h_class, QUEUE_LIST_ENTRIES, CLS_METHOD_RD | CLS_METHOD_WR, cls_queue_list_entries, &h_queue_list_entries);
   cls_register_cxx_method(h_class, QUEUE_REMOVE_ENTRIES, CLS_METHOD_RD | CLS_METHOD_WR, cls_queue_remove_entries, &h_queue_remove_entries);
   cls_register_cxx_method(h_class, QUEUE_UPDATE_LAST_ENTRY, CLS_METHOD_RD | CLS_METHOD_WR, cls_queue_update_last_entry, &h_queue_update_last_entry);
index 3f6c721f57713806fe86fc801411144ab1f891c9..c610c71a912b6dcfbdb026ed071f973070a6748e 100644 (file)
@@ -60,24 +60,6 @@ void cls_rgw_gc_enqueue(ObjectWriteOperation& op, uint32_t expiration_secs, cls_
   op.exec(RGW_QUEUE_CLASS, GC_ENQUEUE, in);
 }
 
-int cls_rgw_gc_dequeue(IoCtx& io_ctx, string& oid, cls_rgw_gc_obj_info& info)
-{
-  bufferlist in, out;
-
-  int r = io_ctx.exec(oid, RGW_QUEUE_CLASS, GC_DEQUEUE, in, out);
-  if (r < 0)
-    return r;
-
-  auto iter = out.cbegin();
-  try {
-    decode(info, iter);
-  } catch (buffer::error& err) {
-    return -EIO;
-  }
-
-  return 0;
-}
-
 int cls_rgw_gc_list_queue(IoCtx& io_ctx, string& oid, string& marker, uint32_t max, bool expired_only,
                     list<cls_rgw_gc_obj_info>& entries, bool *truncated, string& next_marker)
 {
index dda4690f069b6bcf8efb104a3bc41ebad25bf75c..bf396971bc95039c02304dee30fead83f3c2f881 100644 (file)
@@ -321,147 +321,6 @@ int cls_enqueue(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
   return 0;
 }
 
-int cls_dequeue(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
-{
-  //get head and its size
-  uint64_t head_size = 0;
-  cls_queue_head head;
-  int ret = get_queue_head_and_size(hctx, head, head_size);
-  if (ret < 0) {
-    return ret;
-  }
-
-  if (head.front == head.tail && head.is_empty) {
-    CLS_LOG(1, "ERROR: Queue is empty\n");
-    return -ENOENT;
-  }
-
-  uint64_t data_size = 0;
-  bufferlist bl_size;
-
-  if (head.front < head.tail) {
-    //Read size of data first
-    ret = cls_cxx_read(hctx, head.front, sizeof(uint64_t), &bl_size);
-    if (ret < 0) {
-      return ret;
-    }
-    auto iter = bl_size.cbegin();
-    try {
-      decode(data_size, iter);
-    } catch (buffer::error& err) {
-      CLS_LOG(1, "ERROR: cls_dequeue: failed to decode data size \n");
-      return -EINVAL;
-    }
-    CLS_LOG(1, "INFO: cls_dequeue: Data size: %lu, front offset: %lu\n", data_size, head.front);
-    head.front += sizeof(uint64_t);
-    //Read data based on size obtained above
-    CLS_LOG(1, "INFO: cls_dequeue: Data is read from from front offset %lu\n", head.front);
-    ret = cls_cxx_read2(hctx, head.front, data_size, out, CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL);
-    if (ret < 0) {
-      return ret;
-    }
-    head.front += data_size;
-  } else if (head.front >= head.tail) {
-    uint64_t actual_data_size = head.queue_size - head.front;
-    if (actual_data_size < sizeof(uint64_t)) {
-      //Case 1. Data size has been spliced, first reconstruct data size
-      CLS_LOG(1, "INFO: cls_dequeue: Spliced data size is read from from front offset %lu\n", head.front);
-      ret = cls_cxx_read2(hctx, head.front, actual_data_size, &bl_size, CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL);
-      if (ret < 0) {
-        return ret;
-      }
-      head.front = head_size;
-      uint64_t remainder_data_size = sizeof(uint64_t) - actual_data_size;
-      bufferlist bl_rem_data_size;
-      CLS_LOG(1, "INFO: cls_dequeue: Remainder Spliced data size is read from from front offset %lu\n", head.front);
-      ret = cls_cxx_read(hctx, head.front, remainder_data_size, &bl_rem_data_size);
-      if (ret < 0) {
-        return ret;
-      }
-      bl_size.claim_append(bl_rem_data_size);
-      auto iter = bl_size.cbegin();
-      try {
-        decode(data_size, iter);
-      } catch (buffer::error& err) {
-        CLS_LOG(1, "ERROR: cls_dequeue: failed to decode data size \n");
-        return -EINVAL;
-      }
-      head.front += remainder_data_size;
-      CLS_LOG(1, "INFO: cls_dequeue: Data is read from from front offset %lu\n", head.front);
-      ret = cls_cxx_read2(hctx, head.front, data_size, out, CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL);
-      if (ret < 0) {
-        return ret;
-      }
-      head.front += data_size;
-    } else {
-      ret = cls_cxx_read(hctx, head.front, sizeof(uint64_t), &bl_size);
-      if (ret < 0) {
-        return ret;
-      }
-      auto iter = bl_size.cbegin();
-      try {
-        decode(data_size, iter);
-      } catch (buffer::error& err) {
-        CLS_LOG(1, "ERROR: cls_dequeue: failed to decode data size \n");
-        return -EINVAL;
-      }
-      CLS_LOG(1, "INFO: cls_dequeue: Data size: %lu, front offset: %lu\n", data_size, head.front);
-      head.front += sizeof(uint64_t);
-
-      actual_data_size = head.queue_size - head.front;
-      
-      if (actual_data_size < data_size) {
-        if (actual_data_size != 0) {
-          //Case 2. Data has been spliced
-          CLS_LOG(1, "INFO: cls_dequeue: Spliced data is read from from front offset %lu\n", head.front);
-          ret = cls_cxx_read2(hctx, head.front, actual_data_size, out, CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL);
-          if (ret < 0) {
-            return ret;
-          }
-        }
-        head.front = head_size;
-        bufferlist bl_remainder;
-        uint64_t remainder_size = data_size - actual_data_size;
-        CLS_LOG(1, "INFO: cls_dequeue: Remaining Data is read from from front offset %lu\n", head.front);
-        ret = cls_cxx_read2(hctx, head.front, remainder_size, &bl_remainder, CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL);
-        if (ret < 0) {
-          return ret;
-        }
-        out->claim_append(bl_remainder);
-        head.front += remainder_size;
-      } else {
-        //Case 3. No splicing
-        CLS_LOG(1, "INFO: cls_dequeue: Data is read from from front offset %lu\n", head.front);
-        ret = cls_cxx_read2(hctx, head.front, data_size, out, CEPH_OSD_OP_FLAG_FADVISE_SEQUENTIAL);
-        if (ret < 0) {
-          return ret;
-        }
-        head.front += data_size;
-      }
-    }
-  }
-
-  //front has reached the end, wrap it around
-  if (head.front == head.queue_size) {
-    head.front = head_size;
-  }
-
-  if (head.front == head.tail) {
-    head.is_empty = true;
-  }
-  //Write head back
-  bufferlist bl_head;
-  encode(head, bl_head);
-  CLS_LOG(1, "INFO: cls_enqueue: Writing head of size: %u and front offset is: %lu\n", bl_head.length(), head.front);
-  ret = cls_cxx_write2(hctx, sizeof(uint64_t), bl_head.length(), &bl_head, CEPH_OSD_OP_FLAG_FADVISE_WILLNEED);
-  if (ret < 0) {
-    CLS_LOG(1, "INFO: cls_enqueue: Writing head returned error: %d \n", ret);
-    return ret;
-  }
-  
-  return 0;
-}
-
 int cls_queue_list_entries(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
 {
   //get head and its size
index ef289d9bf029bc69fa2fba6fa10226ab1b9858fd..563d8213d4d077eaa94525534445dc793adf201c 100644 (file)
@@ -117,26 +117,6 @@ static int cls_gc_enqueue(cls_method_context_t hctx, bufferlist *in, bufferlist
   return cls_enqueue(hctx, in, out);
 }
 
-static int cls_gc_dequeue(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
-{
-  int r = cls_dequeue(hctx, in, out);
-  if (r < 0)
-    return r;
-
-  cls_rgw_gc_obj_info data;
-  auto iter = out->cbegin();
-  try {
-    decode(data, iter);
-  } catch (buffer::error& err) {
-    CLS_LOG(1, "ERROR: cls_gc_dequeue(): failed to decode entry\n");
-    return -EINVAL;
-  }
-
-  CLS_LOG(1, "INFO: tag of gc info is %s\n", data.tag.c_str());
-
-  return 0;
-}
-
 static int cls_gc_queue_list(cls_method_context_t hctx, bufferlist *in, bufferlist *out)
 {
   CLS_LOG(1, "INFO: cls_gc_queue_list(): Entered cls_gc_queue_list \n");
@@ -665,7 +645,6 @@ CLS_INIT(rgw_queue)
   cls_method_handle_t h_gc_create_queue;
   cls_method_handle_t h_gc_init_queue;
   cls_method_handle_t h_gc_enqueue;
-  cls_method_handle_t h_gc_dequeue;
   cls_method_handle_t h_gc_queue_list_entries;
   cls_method_handle_t h_gc_queue_remove_entries;
   cls_method_handle_t h_gc_queue_update_entry;
@@ -676,7 +655,6 @@ CLS_INIT(rgw_queue)
   cls_register_cxx_method(h_class, GC_CREATE_QUEUE, CLS_METHOD_RD | CLS_METHOD_WR, cls_gc_create_queue, &h_gc_create_queue);
   cls_register_cxx_method(h_class, GC_INIT_QUEUE, CLS_METHOD_RD | CLS_METHOD_WR, cls_gc_init_queue, &h_gc_init_queue);
   cls_register_cxx_method(h_class, GC_ENQUEUE, CLS_METHOD_RD | CLS_METHOD_WR, cls_gc_enqueue, &h_gc_enqueue);
-  cls_register_cxx_method(h_class, GC_DEQUEUE, CLS_METHOD_RD | CLS_METHOD_WR, cls_gc_dequeue, &h_gc_dequeue);
   cls_register_cxx_method(h_class, GC_QUEUE_LIST_ENTRIES, CLS_METHOD_RD, cls_gc_queue_list, &h_gc_queue_list_entries);
   cls_register_cxx_method(h_class, GC_QUEUE_REMOVE_ENTRIES, CLS_METHOD_RD | CLS_METHOD_WR, cls_gc_queue_remove, &h_gc_queue_remove_entries);
   cls_register_cxx_method(h_class, GC_QUEUE_UPDATE_ENTRY, CLS_METHOD_RD | CLS_METHOD_WR, cls_gc_queue_update_entry, &h_gc_queue_update_entry);