*
* An iterator for listing the objects in a pool.
* Used with rados_nobjects_list_open(),
- * rados_nobjects_list_next(), and
+ * rados_nobjects_list_next(), rados_nobjects_list_next2(), and
* rados_nobjects_list_close().
*/
typedef void *rados_list_ctx_t;
const char **key,
const char **nspace);
+/**
+ * Get the next object name, locator and their sizes in the pool
+ *
+ * The sizes allow to list objects with \0 (the NUL character)
+ * in .e.g *entry. Is is unusual see such object names but a bug
+ * in a client has risen the need to handle them as well.
+ * *entry and *key are valid until next call to rados_nobjects_list_*
+ *
+ * @param ctx iterator marking where you are in the listing
+ * @param entry where to store the name of the entry
+ * @param key where to store the object locator (set to NULL to ignore)
+ * @param nspace where to store the object namespace (set to NULL to ignore)
+ * @param entry_size where to store the size of name of the entry
+ * @param key_size where to store the size of object locator (set to NULL to ignore)
+ * @param nspace_size where to store the size of object namespace (set to NULL to ignore)
+ * @returns 0 on success, negative error code on failure
+ * @returns -ENOENT when there are no more objects to list
+ */
+CEPH_RADOS_API int rados_nobjects_list_next2(rados_list_ctx_t ctx,
+ const char **entry,
+ const char **key,
+ const char **nspace,
+ size_t *entry_size,
+ size_t *key_size,
+ size_t *nspace_size);
+
/**
* Close the object listing handle.
*
const char **nspace)
{
tracepoint(librados, rados_nobjects_list_next_enter, listctx);
+ uint32_t retval = rados_nobjects_list_next2(listctx, entry, key, nspace, NULL, NULL, NULL);
+ tracepoint(librados, rados_nobjects_list_next_exit, 0, *entry, key, nspace);
+ return retval;
+}
+LIBRADOS_C_API_BASE_DEFAULT(rados_nobjects_list_next);
+
+extern "C" int LIBRADOS_C_API_DEFAULT_F(rados_nobjects_list_next2)(
+ rados_list_ctx_t listctx,
+ const char **entry,
+ const char **key,
+ const char **nspace,
+ size_t *entry_size,
+ size_t *key_size,
+ size_t *nspace_size)
+{
+ tracepoint(librados, rados_nobjects_list_next2_enter, listctx);
librados::ObjListCtx *lh = (librados::ObjListCtx *)listctx;
Objecter::NListContext *h = lh->nlc;
if (h->list.empty()) {
int ret = lh->ctx->nlist(lh->nlc, RADOS_LIST_MAX_ENTRIES);
if (ret < 0) {
- tracepoint(librados, rados_nobjects_list_next_exit, ret, NULL, NULL, NULL);
+ tracepoint(librados, rados_nobjects_list_next2_exit, ret, NULL, NULL, NULL, NULL, NULL, NULL);
return ret;
}
if (h->list.empty()) {
- tracepoint(librados, rados_nobjects_list_next_exit, -ENOENT, NULL, NULL, NULL);
+ tracepoint(librados, rados_nobjects_list_next2_exit, -ENOENT, NULL, NULL, NULL, NULL, NULL, NULL);
return -ENOENT;
}
}
}
if (nspace)
*nspace = h->list.front().nspace.c_str();
- tracepoint(librados, rados_nobjects_list_next_exit, 0, *entry, key, nspace);
+
+ if (entry_size)
+ *entry_size = h->list.front().oid.size();
+ if (key_size)
+ *key_size = h->list.front().locator.size();
+ if (nspace_size)
+ *nspace_size = h->list.front().nspace.size();
+
+ tracepoint(librados, rados_nobjects_list_next2_exit, 0, entry, key, nspace,
+ entry_size, key_size, nspace_size);
return 0;
}
-LIBRADOS_C_API_BASE_DEFAULT(rados_nobjects_list_next);
+LIBRADOS_C_API_BASE_DEFAULT(rados_nobjects_list_next2);
/*
)
)
+TRACEPOINT_EVENT(librados, rados_nobjects_list_next2_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_next2_exit,
+ TP_ARGS(
+ int, retval,
+ const char* const*, entry,
+ const char* const*, key,
+ const char* const*, nspace,
+ const size_t*, entry_size,
+ const size_t*, key_size,
+ const size_t*, nspace_size),
+ TP_FIELDS(
+ ctf_integer(int, retval, retval)
+ ceph_ctf_sequencep(char, entry, entry, size_t, entry_size)
+ ceph_ctf_sequencep(char, key, key, size_t, key_size)
+ ceph_ctf_sequencep(char, nspace, nspace, size_t, nspace_size)
+ )
+)
+
+
TRACEPOINT_EVENT(librados, rados_objects_list_open_enter,
TP_ARGS(
rados_ioctx_t, ioctx),