From 34098a39e2012781f7acf8fc8ea646e549aa420b Mon Sep 17 00:00:00 2001 From: Yehuda Sadeh Date: Mon, 13 Jun 2011 11:29:30 -0700 Subject: [PATCH] librados: expose pool id Conflicts: src/librados.cc --- src/include/rados/librados.h | 3 ++- src/include/rados/librados.hpp | 2 ++ src/librados.cc | 16 ++++++++++++++++ 3 files changed, 20 insertions(+), 1 deletion(-) diff --git a/src/include/rados/librados.h b/src/include/rados/librados.h index b681cfcbe0c16..16cd3103f41d6 100644 --- a/src/include/rados/librados.h +++ b/src/include/rados/librados.h @@ -17,7 +17,7 @@ extern "C" { #endif #define LIBRADOS_VER_MAJOR 0 -#define LIBRADOS_VER_MINOR 27 +#define LIBRADOS_VER_MINOR 30 #define LIBRADOS_VER_EXTRA 0 #define LIBRADOS_VERSION(maj, min, extra) ((maj << 16) + (min << 8) + extra) @@ -114,6 +114,7 @@ int rados_pool_delete(rados_t cluster, const char *pool_name); int rados_ioctx_pool_set_auid(rados_ioctx_t io, uint64_t auid); void rados_ioctx_locator_set_key(rados_ioctx_t io, const char *key); +int rados_ioctx_get_id(rados_ioctx_t io); /* objects */ int rados_objects_list_open(rados_ioctx_t io, rados_list_ctx_t *ctx); diff --git a/src/include/rados/librados.hpp b/src/include/rados/librados.hpp index 8609777a0a3fa..7f956fb6dfd2f 100644 --- a/src/include/rados/librados.hpp +++ b/src/include/rados/librados.hpp @@ -234,6 +234,8 @@ namespace librados const std::string& get_pool_name() const; void locator_set_key(const std::string& key); + + int get_id(); private: /* You can only get IoCtx instances from Rados */ IoCtx(IoCtxImpl *io_ctx_impl_); diff --git a/src/librados.cc b/src/librados.cc index df4cd475af119..a7f513263abe3 100644 --- a/src/librados.cc +++ b/src/librados.cc @@ -144,6 +144,10 @@ struct librados::IoCtxImpl { void queue_aio_write(struct AioCompletionImpl *c); void complete_aio_write(struct AioCompletionImpl *c); void flush_aio_writes(); + + int get_id() { + return poolid; + } }; @@ -2671,6 +2675,12 @@ locator_set_key(const string& key) io_ctx_impl->oloc.key = key; } +int librados::IoCtx:: +get_id() +{ + return io_ctx_impl->get_id(); +} + librados::IoCtx:: IoCtx(IoCtxImpl *io_ctx_impl_) : io_ctx_impl(io_ctx_impl_) @@ -3211,6 +3221,12 @@ extern "C" void rados_ioctx_locator_set_key(rados_ioctx_t io, const char *key) else ctx->oloc.key = ""; } + +extern "C" int rados_ioctx_get_id(rados_ioctx_t io) +{ + librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io; + return ctx->get_id(); +} // snaps extern "C" int rados_ioctx_snap_create(rados_ioctx_t io, const char *snapname) -- 2.39.5