CEPH_RADOS_API uint32_t rados_nobjects_list_seek(rados_list_ctx_t ctx,
uint32_t pos);
+/**
+ * Reposition object iterator to a different position
+ *
+ * @param ctx iterator marking where you are in the listing
+ * @param cursor position to move to
+ * @returns rounded position we moved to
+ */
+CEPH_RADOS_API uint32_t rados_nobjects_list_seek_cursor(rados_list_ctx_t ctx,
+ rados_object_list_cursor cursor);
+
+/**
+ * Reposition object iterator to a different position
+ *
+ * The returned handle must be released with rados_object_list_cursor_free().
+ *
+ * @param ctx iterator marking where you are in the listing
+ * @param cursor where to store cursor
+ * @returns 0 on success, negative error code on failure
+ */
+CEPH_RADOS_API int rados_nobjects_list_get_cursor(rados_list_ctx_t ctx,
+ rados_object_list_cursor *cursor);
+
/**
* Get the next object name and locator in the pool
*
/// move the iterator to a given hash position. this may (will!) be rounded to the nearest pg.
uint32_t seek(uint32_t pos);
+ /// move the iterator to a given cursor position
+ uint32_t seek(const ObjectCursor& cursor);
+
+ /// get current cursor position
+ ObjectCursor get_cursor();
+
/**
* Configure PGLS filter to be applied OSD-side (requires caller
* to know/understand the format expected by the OSD)
NObjectIterator nobjects_begin(uint32_t start_hash_position);
NObjectIterator nobjects_begin(uint32_t start_hash_position,
const bufferlist &filter);
+ /// Start enumerating objects for a pool starting from cursor
+ NObjectIterator nobjects_begin(const librados::ObjectCursor& cursor);
+ NObjectIterator nobjects_begin(const librados::ObjectCursor& cursor,
+ const bufferlist &filter);
/// Iterator indicating the end of a pool
const NObjectIterator& nobjects_end() const;
return objecter->list_nobjects_seek(context, pos);
}
+uint32_t librados::IoCtxImpl::nlist_seek(Objecter::NListContext *context,
+ const rados_object_list_cursor& cursor)
+{
+ context->list.clear();
+ return objecter->list_nobjects_seek(context, *(const hobject_t *)cursor);
+}
+
+rados_object_list_cursor librados::IoCtxImpl::nlist_get_cursor(Objecter::NListContext *context)
+{
+ hobject_t *c = new hobject_t;
+
+ objecter->list_nobjects_get_cursor(context, c);
+ return (rados_object_list_cursor)c;
+}
+
int librados::IoCtxImpl::create(const object_t& oid, bool exclusive)
{
::ObjectOperation op;
// io
int nlist(Objecter::NListContext *context, int max_entries);
uint32_t nlist_seek(Objecter::NListContext *context, uint32_t pos);
+ uint32_t nlist_seek(Objecter::NListContext *context, const rados_object_list_cursor& cursor);
+ rados_object_list_cursor nlist_get_cursor(Objecter::NListContext *context);
void object_list_slice(
const hobject_t start,
const hobject_t finish,
/// move the iterator to a given hash position. this may (will!) be rounded to the nearest pg.
uint32_t seek(uint32_t pos);
+ /// move the iterator to a given cursor position
+ uint32_t seek(const librados::ObjectCursor& cursor);
+
+ /// get current cursor position
+ librados::ObjectCursor get_cursor();
+
void set_filter(const bufferlist &bl);
private:
return r;
}
+uint32_t librados::NObjectIteratorImpl::seek(const ObjectCursor& cursor)
+{
+ uint32_t r = rados_nobjects_list_seek_cursor(ctx.get(), (rados_object_list_cursor)cursor.c_cursor);
+ get_next();
+ return r;
+}
+
+librados::ObjectCursor librados::NObjectIteratorImpl::get_cursor()
+{
+ librados::ObjListCtx *lh = (librados::ObjListCtx *)ctx.get();
+ librados::ObjectCursor oc;
+ oc.set(lh->ctx->nlist_get_cursor(lh->nlc));
+ return oc;
+}
+
void librados::NObjectIteratorImpl::set_filter(const bufferlist &bl)
{
assert(ctx);
return impl->seek(pos);
}
+uint32_t librados::NObjectIterator::seek(const ObjectCursor& cursor)
+{
+ assert(impl);
+ return impl->seek(cursor);
+}
+
+librados::ObjectCursor librados::NObjectIterator::get_cursor()
+{
+ assert(impl);
+ return impl->get_cursor();
+}
+
void librados::NObjectIterator::set_filter(const bufferlist &bl)
{
impl->set_filter(bl);
return iter;
}
+librados::NObjectIterator librados::IoCtx::nobjects_begin(const ObjectCursor& cursor)
+{
+ bufferlist bl;
+ return nobjects_begin(cursor, bl);
+}
+
+librados::NObjectIterator librados::IoCtx::nobjects_begin(
+ const ObjectCursor& cursor, const bufferlist &filter)
+{
+ rados_list_ctx_t listh;
+ rados_nobjects_list_open(io_ctx_impl, &listh);
+ NObjectIterator iter((ObjListCtx*)listh);
+ if (filter.length() > 0) {
+ iter.set_filter(filter);
+ }
+ iter.seek(cursor);
+ return iter;
+}
+
const librados::NObjectIterator& librados::IoCtx::nobjects_end() const
{
return NObjectIterator::__EndObjectIterator;
return r;
}
+extern "C" uint32_t rados_nobjects_list_seek_cursor(rados_list_ctx_t listctx,
+ rados_object_list_cursor cursor)
+{
+ librados::ObjListCtx *lh = (librados::ObjListCtx *)listctx;
+
+ tracepoint(librados, rados_nobjects_list_seek_cursor_enter, listctx);
+ uint32_t r = lh->ctx->nlist_seek(lh->nlc, cursor);
+ tracepoint(librados, rados_nobjects_list_seek_cursor_exit, r);
+ return r;
+}
+
+extern "C" int rados_nobjects_list_get_cursor(rados_list_ctx_t listctx,
+ rados_object_list_cursor *cursor)
+{
+ librados::ObjListCtx *lh = (librados::ObjListCtx *)listctx;
+
+ tracepoint(librados, rados_nobjects_list_get_cursor_enter, listctx);
+ *cursor = lh->ctx->nlist_get_cursor(lh->nlc);
+ tracepoint(librados, rados_nobjects_list_get_cursor_exit, 0);
+ return 0;
+}
+
extern "C" uint32_t rados_nobjects_list_get_pg_hash_position(
rados_list_ctx_t listctx)
{
)
)
+TRACEPOINT_EVENT(librados, rados_nobjects_list_seek_cursor_enter,
+ TP_ARGS(
+ rados_list_ctx_t, listctx),
+ TP_FIELDS(
+ ctf_integer_hex(rados_list_ctx_t, listctx, listctx)
+ )
+)
+
+TRACEPOINT_EVENT(librados, rados_nobjects_list_seek_cursor_exit,
+ TP_ARGS(
+ uint32_t, retval),
+ TP_FIELDS(
+ ctf_integer(int, retval, retval)
+ )
+)
+
+TRACEPOINT_EVENT(librados, rados_nobjects_list_get_cursor_enter,
+ TP_ARGS(
+ rados_list_ctx_t, listctx),
+ TP_FIELDS(
+ ctf_integer_hex(rados_list_ctx_t, listctx, listctx)
+ )
+)
+
+TRACEPOINT_EVENT(librados, rados_nobjects_list_get_cursor_exit,
+ TP_ARGS(
+ uint32_t, retval),
+ TP_FIELDS(
+ ctf_integer(int, retval, retval)
+ )
+)
+
TRACEPOINT_EVENT(librados, rados_nobjects_list_get_pg_hash_position_enter,
TP_ARGS(
rados_list_ctx_t, listctx),