summaryrefslogtreecommitdiff
path: root/src/librados
diff options
context:
space:
mode:
authorYehuda Sadeh <yehuda@hq.newdream.net>2012-03-20 15:15:09 -0700
committerYehuda Sadeh <yehuda@hq.newdream.net>2012-03-20 15:15:09 -0700
commit6a5cbec38b761d524e699e2a7410a340d093ccca (patch)
treef4cbe1bdae719ab3570b2aaba1a8b14c4e8d1fa6 /src/librados
parente0b8f7a0331b0ceee54a911bb9231cb168eb2d0f (diff)
downloadceph-6a5cbec38b761d524e699e2a7410a340d093ccca.tar.gz
rgw: replace bucket_id generation
bucket_id is now string: <global instance id>.<num> where num is increasing monotonically within the current rgw instance. Signed-off-by: Yehuda Sadeh <yehuda@hq.newdream.net>
Diffstat (limited to 'src/librados')
-rw-r--r--src/librados/RadosClient.cc12
-rw-r--r--src/librados/RadosClient.h2
-rw-r--r--src/librados/librados.cc11
3 files changed, 25 insertions, 0 deletions
diff --git a/src/librados/RadosClient.cc b/src/librados/RadosClient.cc
index 2c0fc086834..895db3ea091 100644
--- a/src/librados/RadosClient.cc
+++ b/src/librados/RadosClient.cc
@@ -196,6 +196,18 @@ void librados::RadosClient::shutdown()
ldout(cct, 1) << "shutdown" << dendl;
}
+uint64_t librados::RadosClient::get_instance_id()
+{
+ lock.Lock();
+ if (state == DISCONNECTED) {
+ lock.Unlock();
+ return 0;
+ }
+ uint64_t id = monclient.get_global_id();
+ lock.Unlock();
+ return id;
+}
+
librados::RadosClient::~RadosClient()
{
if (messenger)
diff --git a/src/librados/RadosClient.h b/src/librados/RadosClient.h
index 4ef76d1576f..9f92458da12 100644
--- a/src/librados/RadosClient.h
+++ b/src/librados/RadosClient.h
@@ -70,6 +70,8 @@ public:
int connect();
void shutdown();
+ uint64_t get_instance_id();
+
int create_ioctx(const char *name, IoCtxImpl **io);
int64_t lookup_pool(const char *name);
diff --git a/src/librados/librados.cc b/src/librados/librados.cc
index bd113f8b02a..21bf0330875 100644
--- a/src/librados/librados.cc
+++ b/src/librados/librados.cc
@@ -1027,6 +1027,11 @@ void librados::Rados::shutdown()
client = NULL;
}
+uint64_t librados::Rados::get_instance_id()
+{
+ return client->get_instance_id();
+}
+
int librados::Rados::conf_read_file(const char * const path) const
{
return rados_conf_read_file((rados_t)client, path);
@@ -1279,6 +1284,12 @@ extern "C" void rados_shutdown(rados_t cluster)
delete radosp;
}
+extern "C" uint64_t rados_get_instance_id(rados_t cluster)
+{
+ librados::RadosClient *client = (librados::RadosClient *)cluster;
+ return client->get_instance_id();
+}
+
extern "C" void rados_version(int *major, int *minor, int *extra)
{
if (major)