]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
objecter: new calls to support cursor with nobjects
authorYehuda Sadeh <yehuda@redhat.com>
Wed, 8 Feb 2017 23:32:17 +0000 (15:32 -0800)
committerYehuda Sadeh <yehuda@redhat.com>
Wed, 15 Feb 2017 23:28:55 +0000 (15:28 -0800)
Signed-off-by: Yehuda Sadeh <yehuda@redhat.com>
src/osdc/Objecter.cc
src/osdc/Objecter.h

index 9f20843b4ae0ff0766f1a206b8924966ad0ed73c..440b7c8a6acbfa1e3408239b38a45c7225ca6fa1 100644 (file)
@@ -3515,6 +3515,33 @@ uint32_t Objecter::list_nobjects_seek(NListContext *list_context,
   return pos;
 }
 
+uint32_t Objecter::list_nobjects_seek(NListContext *list_context,
+                                     const hobject_t& cursor)
+{
+  shared_lock rl(rwlock);
+  ldout(cct, 10) << "list_nobjects_seek " << list_context << dendl;
+  list_context->pos = cursor;
+  list_context->at_end_of_pool = false;
+  pg_t actual = osdmap->raw_pg_to_pg(pg_t(cursor.get_hash(), list_context->pool_id));
+  list_context->current_pg = actual.ps();
+  list_context->sort_bitwise = true;
+  return list_context->current_pg;
+}
+
+void Objecter::list_nobjects_get_cursor(NListContext *list_context,
+                                        hobject_t *cursor)
+{
+  shared_lock rl(rwlock);
+  if (list_context->list.empty()) {
+    *cursor = list_context->pos;
+  } else {
+    const librados::ListObjectImpl& entry = list_context->list.front();
+    const string *key = (entry.locator.empty() ? &entry.oid : &entry.locator);
+    uint32_t h = osdmap->get_pg_pool(list_context->pool_id)->hash_key(*key, entry.nspace);
+    *cursor = hobject_t(entry.oid, entry.locator, list_context->pool_snap_seq, h, list_context->pool_id, entry.nspace);
+  }
+}
+
 void Objecter::list_nobjects(NListContext *list_context, Context *onfinish)
 {
   ldout(cct, 10) << __func__ << " pool_id " << list_context->pool_id
index fc8dce0304cdc9a0e6a67812fba9d33d9bffb8be..3dd8e96efbfa0f13048994fa8de36dec1a7fc2b9 100644 (file)
@@ -2731,6 +2731,8 @@ public:
 
   void list_nobjects(NListContext *p, Context *onfinish);
   uint32_t list_nobjects_seek(NListContext *p, uint32_t pos);
+  uint32_t list_nobjects_seek(NListContext *list_context, const hobject_t& c);
+  void list_nobjects_get_cursor(NListContext *list_context, hobject_t *c);
 
   hobject_t enumerate_objects_begin();
   hobject_t enumerate_objects_end();