*/
int rados_pool_list(rados_t cluster, char *buf, int len);
-int rados_ioctx_open(rados_t cluster, const char *pool_name, rados_ioctx_t *ioctx);
-void rados_ioctx_close(rados_ioctx_t io);
+int rados_ioctx_create(rados_t cluster, const char *pool_name, rados_ioctx_t *ioctx);
+void rados_ioctx_destroy(rados_ioctx_t io);
int rados_ioctx_lookup(rados_t cluster, const char *pool_name);
int rados_ioctx_stat(rados_ioctx_t io, struct rados_ioctx_stat_t *stats);
* Typical use (error checking omitted):
*
* IoCtx *p;
- * rados.ioctx_open("my_pool", &pool);
+ * rados.ioctx_create("my_pool", &pool);
* p->stat(&stats);
* ... etc ...
* delete p; // close our pool handle
int pool_delete(const char *name);
int pool_lookup(const char *name);
- int ioctx_open(const char *name, IoCtx &pool);
+ int ioctx_create(const char *name, IoCtx &pool);
/* listing objects */
int pool_list(std::list<std::string>& v);
}
int librados::Rados::
-ioctx_open(const char *name, IoCtx &io)
+ioctx_create(const char *name, IoCtx &io)
{
rados_ioctx_t p;
- int ret = rados_ioctx_open((rados_t)client, name, &p);
+ int ret = rados_ioctx_create((rados_t)client, name, &p);
if (ret)
return ret;
io.io_ctx_impl = (IoCtxImpl*)p;
return needed + 1;
}
-extern "C" int rados_ioctx_open(rados_t cluster, const char *name, rados_ioctx_t *io)
+extern "C" int rados_ioctx_create(rados_t cluster, const char *name, rados_ioctx_t *io)
{
librados::RadosClient *radosp = (librados::RadosClient *)cluster;
int poolid = radosp->lookup_pool(name);
return poolid;
}
-extern "C" void rados_ioctx_close(rados_ioctx_t io)
+extern "C" void rados_ioctx_destroy(rados_ioctx_t io)
{
librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
delete ctx;
// open io context.
IoCtx io_ctx;
if (pool_name) {
- ret = rados.ioctx_open(pool_name, io_ctx);
+ ret = rados.ioctx_create(pool_name, io_ctx);
if (ret < 0) {
cerr << "error opening pool " << pool_name << ": "
<< strerror_r(-ret, buf, sizeof(buf)) << std::endl;
const char *oid = "bar";
IoCtx io_ctx;
- int r = rados.ioctx_open("data", io_ctx);
+ int r = rados.ioctx_create("data", io_ctx);
cout << "open io_ctx result = " << r << " pool = " << io_ctx.get_pool_name() << std::endl;
ACLID id;
}
// TODO: add conf
- int r = rados.ioctx_open(poolname, io_ctx);
+ int r = rados.ioctx_create(poolname, io_ctx);
if (r < 0) {
cerr << "error opening pool " << poolname << " (err=" << r << ")" << std::endl;
exit(1);
}
if (opt_cmd == OPT_COPY || opt_cmd == OPT_IMPORT) {
- r = rados.ioctx_open(dest_poolname, dest_io_ctx);
+ r = rados.ioctx_create(dest_poolname, dest_io_ctx);
if (r < 0) {
cerr << "error opening pool " << dest_poolname << " (err=" << r << ")" << std::endl;
exit(1);
*/
int RGWRados::open_root_pool_ctx()
{
- int r = rados->ioctx_open(root_bucket.c_str(), root_pool_ctx);
+ int r = rados->ioctx_create(root_bucket.c_str(), root_pool_ctx);
if (r == -ENOENT) {
r = rados->pool_create(root_bucket.c_str());
if (r < 0)
return r;
- r = rados->ioctx_open(root_bucket.c_str(), root_pool_ctx);
+ r = rados->ioctx_create(root_bucket.c_str(), root_pool_ctx);
}
return r;
string& marker, vector<RGWObjEnt>& result, map<string, bool>& common_prefixes)
{
librados::IoCtx io_ctx;
- int r = rados->ioctx_open(bucket.c_str(), io_ctx);
+ int r = rados->ioctx_create(bucket.c_str(), io_ctx);
if (r < 0)
return r;
{
librados::IoCtx io_ctx;
- int r = rados->ioctx_open(bucket.c_str(), io_ctx);
+ int r = rados->ioctx_create(bucket.c_str(), io_ctx);
if (r < 0)
return r;
{
librados::IoCtx io_ctx;
- int r = rados->ioctx_open(bucket.c_str(), io_ctx);
+ int r = rados->ioctx_create(bucket.c_str(), io_ctx);
if (r < 0)
return r;
int RGWRados::delete_obj(std::string& id, std::string& bucket, std::string& oid)
{
librados::IoCtx io_ctx;
- int r = rados->ioctx_open(bucket.c_str(), io_ctx);
+ int r = rados->ioctx_create(bucket.c_str(), io_ctx);
if (r < 0)
return r;
actual_bucket = root_bucket;
}
- int r = rados->ioctx_open(actual_bucket.c_str(), io_ctx);
+ int r = rados->ioctx_create(actual_bucket.c_str(), io_ctx);
if (r < 0)
return r;
actual_bucket = root_bucket;
}
- int r = rados->ioctx_open(actual_bucket.c_str(), io_ctx);
+ int r = rados->ioctx_create(actual_bucket.c_str(), io_ctx);
if (r < 0)
return r;
*handle = state;
- r = rados->ioctx_open(bucket.c_str(), state->io_ctx);
+ r = rados->ioctx_create(bucket.c_str(), state->io_ctx);
if (r < 0)
goto done_err;
{
rados.init(NULL);
rados.connect();
- rados.ioctx_open(pool_name.c_str(), io_ctx);
+ rados.ioctx_create(pool_name.c_str(), io_ctx);
char hostname_cstr[100];
gethostname(hostname_cstr, 100);
stringstream hostpid;
}
int r = rados_pool_create(cluster, TEST_POOL);
printf("rados_pool_create returned %d\n", r);
- assert(rados_ioctx_open(cluster, TEST_POOL, &io_ctx) == 0);
+ assert(rados_ioctx_create(cluster, TEST_POOL, &io_ctx) == 0);
struct rados_ioctx_stat_t stats;
rados_ioctx_stat(io_ctx, &stats);
test_ls(io_ctx, 0);
test_ls(io_ctx, 1, TEST_IMAGE "1");
test_delete(io_ctx, TEST_IMAGE "1");
test_ls(io_ctx, 0);
- rados_ioctx_close(io_ctx);
+ rados_ioctx_destroy(io_ctx);
rados_shutdown(cluster);
return 0;
}
}
int r = rados.pool_create(TEST_POOL);
printf("rados.pool_create returned %d\n", r);
- assert(rados.ioctx_open(TEST_POOL, io_ctx) == 0);
+ assert(rados.ioctx_create(TEST_POOL, io_ctx) == 0);
test_ls(io_ctx, 0);
test_create_and_stat(io_ctx, TEST_IMAGE, MB_BYTES(1));
assert(rbd->open(io_ctx, image.get(), TEST_IMAGE, NULL) == 0);
printf("rados_ioctx_create = %d\n", r);
rados_ioctx_t io_ctx;
- r = rados_ioctx_open(cl, "foo", &io_ctx);
- printf("rados_ioctx_open = %d, io_ctx = %p\n", r, io_ctx);
+ r = rados_ioctx_create(cl, "foo", &io_ctx);
+ printf("rados_ioctx_create = %d, io_ctx = %p\n", r, io_ctx);
/* list all pools */
{
/* delete a pool */
printf("rados_delete_pool = %d\n", r);
- rados_ioctx_close(io_ctx);
+ rados_ioctx_destroy(io_ctx);
r = rados_pool_delete(cl, "foo");
printf("rados_ioctx_pool_delete = %d\n", r);
const char *oid = "bar";
IoCtx io_ctx;
- int r = rados.ioctx_open("data", io_ctx);
- cout << "ioctx_open result = " << r << std::endl;
+ int r = rados.ioctx_create("data", io_ctx);
+ cout << "ioctx_create result = " << r << std::endl;
r = io_ctx.write(oid, bl, bl.length(), 0);
uint64_t objver = io_ctx.get_last_version();