/** @endcond */
/** @} */
-struct CephContext;
-
/**
* @typedef rados_t
*
*/
typedef void *rados_t;
+/**
+ * @tyepdef rados_config_t
+ *
+ * A handle for the ceph configuration context for the rados_t cluster
+ * instance. This can be used to share configuration context/state
+ * (e.g., logging configuration) between librados instance.
+ *
+ * @warning The config context does not have independent reference
+ * counting. As such, a rados_config_t handle retrieved from a given
+ * rados_t is only valid as long as that rados_t.
+ */
+typedef void *rados_config_t;
+
/**
* @typedef rados_ioctx_t
*
/**
* Initialize a cluster handle from an existing configuration.
*
- * Copies all configuration, as retrieved by the C++ API.
+ * Share configuration state with another rados_t instance.
*
* @param cluster where to store the handle
* @param cct_ the existing configuration to use
* @returns 0 on success, negative error code on failure
*/
-int rados_create_with_context(rados_t *cluster, struct CephContext *cct_);
+int rados_create_with_context(rados_t *cluster, rados_config_t cct);
/**
* Connect to the cluster.
int rados_pool_list(rados_t cluster, char *buf, size_t len);
/**
- * Get CephContext for a rados cluster handle
+ * Get a configuration handle for a rados cluster handle
+ *
+ * This handle is valid only as long as the cluster handle is valid.
*
* @param cluster cluster handle
- * @returns CephContext for this cluster
+ * @returns config handle for this cluster
*/
-struct CephContext *rados_cct(rados_t cluster);
+rados_config_t rados_cct(rados_t cluster);
/**
* Create an io context
void rados_ioctx_destroy(rados_ioctx_t io);
/**
- * Get CephContext for a pool handle
+ * Get configuration hadnle for a pool handle
*
* @param io pool handle
- * @returns CephContext for this cluster
+ * @returns rados_config_t for this cluster
*/
-struct CephContext *rados_ioctx_cct(rados_ioctx_t io);
+rados_config_t rados_ioctx_cct(rados_ioctx_t io);
/**
* Get pool usage statistics
* already called global_init and want to use that particular configuration for
* their cluster.
*/
-extern "C" int rados_create_with_context(rados_t *pcluster, CephContext *cct)
+extern "C" int rados_create_with_context(rados_t *pcluster, rados_config_t cct_)
{
+ CephContext *cct = (CephContext *)cct_;
librados::RadosClient *radosp = new librados::RadosClient(cct);
*pcluster = (void *)radosp;
return 0;
}
-extern "C" CephContext *rados_cct(rados_t cluster)
+extern "C" rados_config_t rados_cct(rados_t cluster)
{
librados::RadosClient *client = (librados::RadosClient *)cluster;
- return client->cct;
+ return (rados_config_t)client->cct;
}
extern "C" int rados_connect(rados_t cluster)
return 0;
}
-extern "C" struct CephContext *rados_ioctx_cct(rados_ioctx_t io)
+extern "C" rados_config_t rados_ioctx_cct(rados_ioctx_t io)
{
librados::IoCtxImpl *ctx = (librados::IoCtxImpl *)io;
- return ctx->client->cct;
+ return (rados_config_t)ctx->client->cct;
}
extern "C" void rados_ioctx_snap_set_read(rados_ioctx_t io, rados_snap_t seq)