const RGWPubSub ps(res.store, res.user_tenant);
const RGWPubSub::Bucket ps_bucket(ps, res.bucket);
rgw_pubsub_bucket_topics bucket_topics;
- auto rc = ps_bucket.get_topics(res.dpp, &bucket_topics, res.yield);
+ auto rc = ps_bucket.get_topics(res.dpp, bucket_topics, res.yield);
if (rc < 0) {
// failed to fetch bucket topics
return rc;
}
const RGWPubSub::Bucket b(ps, bucket.get());
- ret = b.get_topics(dpp(), &result, null_yield);
+ ret = b.get_topics(dpp(), result, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl;
return -ret;
encode_json("result", result, formatter.get());
} else {
rgw_pubsub_topics result;
- int ret = ps.get_topics(dpp(), &result, null_yield);
+ int ret = ps.get_topics(dpp(), result, null_yield);
if (ret < 0 && ret != -ENOENT) {
cerr << "ERROR: could not get topics: " << cpp_strerror(-ret) << std::endl;
return -ret;
RGWPubSub ps(driver, tenant);
rgw_pubsub_topic topic;
- ret = ps.get_topic(dpp(), topic_name, &topic, null_yield);
+ ret = ps.get_topic(dpp(), topic_name, topic, null_yield);
if (ret < 0) {
cerr << "ERROR: could not get topic: " << cpp_strerror(-ret) << std::endl;
return -ret;
: driver(_driver), tenant(_tenant)
{}
-int RGWPubSub::read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics *result,
+int RGWPubSub::read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result,
RGWObjVersionTracker *objv_tracker, optional_yield y) const
{
- const int ret = driver->read_topics(tenant, *result, objv_tracker, y, dpp);
+ const int ret = driver->read_topics(tenant, result, objv_tracker, y, dpp);
if (ret < 0) {
ldpp_dout(dpp, 10) << "WARNING: failed to read topics info: ret=" << ret << dendl;
return ret;
return 0;
}
-int RGWPubSub::Bucket::read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_bucket_topics *result,
+int RGWPubSub::Bucket::read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_bucket_topics& result,
RGWObjVersionTracker *objv_tracker, optional_yield y) const
{
- const int ret = bucket->read_topics(*result, objv_tracker, y, dpp);
+ const int ret = bucket->read_topics(result, objv_tracker, y, dpp);
if (ret < 0 && ret != -ENOENT) {
ldpp_dout(dpp, 1) << "ERROR: failed to read bucket topics info: ret=" << ret << dendl;
return ret;
return 0;
}
-int RGWPubSub::get_topic(const DoutPrefixProvider *dpp, const std::string& name, rgw_pubsub_topic *result, optional_yield y) const
+int RGWPubSub::get_topic(const DoutPrefixProvider *dpp, const std::string& name, rgw_pubsub_topic& result, optional_yield y) const
{
rgw_pubsub_topics topics;
- const int ret = read_topics(dpp, &topics, nullptr, y);
+ const int ret = read_topics(dpp, topics, nullptr, y);
if (ret < 0) {
ldpp_dout(dpp, 1) << "ERROR: failed to read topics info: ret=" << ret << dendl;
return ret;
return -ENOENT;
}
- *result = iter->second;
+ result = iter->second;
return 0;
}
const rgw::notify::EventTypeList& events, OptionalFilter s3_filter, const std::string& notif_name, optional_yield y) const {
rgw_pubsub_topic topic_info;
- int ret = ps.get_topic(dpp, topic_name, &topic_info, y);
+ int ret = ps.get_topic(dpp, topic_name, topic_info, y);
if (ret < 0) {
ldpp_dout(dpp, 1) << "ERROR: failed to read topic '" << topic_name << "' info: ret=" << ret << dendl;
return ret;
RGWObjVersionTracker objv_tracker;
rgw_pubsub_bucket_topics bucket_topics;
- ret = read_topics(dpp, &bucket_topics, &objv_tracker, y);
+ ret = read_topics(dpp, bucket_topics, &objv_tracker, y);
if (ret < 0) {
ldpp_dout(dpp, 1) << "ERROR: failed to read topics from bucket '" <<
bucket->get_name() << "': ret=" << ret << dendl;
RGWObjVersionTracker objv_tracker;
rgw_pubsub_bucket_topics bucket_topics;
- auto ret = read_topics(dpp, &bucket_topics, &objv_tracker, y);
+ auto ret = read_topics(dpp, bucket_topics, &objv_tracker, y);
if (ret < 0) {
ldpp_dout(dpp, 1) << "ERROR: failed to read bucket topics info: ret=" << ret << dendl;
return ret;
{
// get all topics on a bucket
rgw_pubsub_bucket_topics bucket_topics;
- auto ret = get_topics(dpp, &bucket_topics, y);
+ auto ret = get_topics(dpp, bucket_topics, y);
if (ret < 0 && ret != -ENOENT) {
ldpp_dout(dpp, 1) << "ERROR: failed to get list of topics from bucket '" << bucket->get_name() << "', ret=" << ret << dendl;
return ret ;
RGWObjVersionTracker objv_tracker;
rgw_pubsub_topics topics;
- int ret = read_topics(dpp, &topics, &objv_tracker, y);
+ int ret = read_topics(dpp, topics, &objv_tracker, y);
if (ret < 0 && ret != -ENOENT) {
// its not an error if not topics exist, we create one
ldpp_dout(dpp, 1) << "ERROR: failed to read topics info: ret=" << ret << dendl;
RGWObjVersionTracker objv_tracker;
rgw_pubsub_topics topics;
- int ret = read_topics(dpp, &topics, &objv_tracker, y);
+ int ret = read_topics(dpp, topics, &objv_tracker, y);
if (ret < 0 && ret != -ENOENT) {
ldpp_dout(dpp, 1) << "ERROR: failed to read topics info: ret=" << ret << dendl;
return ret;
rgw::sal::Driver* const driver;
const std::string tenant;
- int read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics *result,
+ int read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result,
RGWObjVersionTracker* objv_tracker, optional_yield y) const;
int write_topics(const DoutPrefixProvider *dpp, const rgw_pubsub_topics& topics,
RGWObjVersionTracker* objv_tracker, optional_yield y) const;
// read the list of topics associated with a bucket and populate into result
// use version tacker to enforce atomicity between read/write
// return 0 on success or if no topic was associated with the bucket, error code otherwise
- int read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_bucket_topics *result,
+ int read_topics(const DoutPrefixProvider *dpp, rgw_pubsub_bucket_topics& result,
RGWObjVersionTracker* objv_tracker, optional_yield y) const;
// set the list of topics associated with a bucket
// use version tacker to enforce atomicity between read/write
// get the list of topics associated with a bucket and populate into result
// return 0 on success or if no topic was associated with the bucket, error code otherwise
- int get_topics(const DoutPrefixProvider *dpp, rgw_pubsub_bucket_topics *result, optional_yield y) const {
+ int get_topics(const DoutPrefixProvider *dpp, rgw_pubsub_bucket_topics& result, optional_yield y) const {
return read_topics(dpp, result, nullptr, y);
}
// adds a topic + filter (event list, and possibly name metadata or tags filters) to a bucket
// get the list of topics
// return 0 on success or if no topic was associated with the bucket, error code otherwise
- int get_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics *result, optional_yield y) const {
+ int get_topics(const DoutPrefixProvider *dpp, rgw_pubsub_topics& result, optional_yield y) const {
return read_topics(dpp, result, nullptr, y);
}
// get a topic with by its name and populate it into "result"
// return -ENOENT if the topic does not exists
// return 0 on success, error code otherwise
- int get_topic(const DoutPrefixProvider *dpp, const std::string& name, rgw_pubsub_topic *result, optional_yield y) const;
+ int get_topic(const DoutPrefixProvider *dpp, const std::string& name, rgw_pubsub_topic& result, optional_yield y) const;
// create a topic with a name only
// if the topic already exists it is a no-op (considered success)
// return 0 on success, error code otherwise
void RGWPSListTopicsOp::execute(optional_yield y) {
const RGWPubSub ps(driver, s->owner.get_id().tenant);
- op_ret = ps.get_topics(this, &result, y);
+ op_ret = ps.get_topics(this, result, y);
// if there are no topics it is not considered an error
op_ret = op_ret == -ENOENT ? 0 : op_ret;
if (op_ret < 0) {
return;
}
const RGWPubSub ps(driver, s->owner.get_id().tenant);
- op_ret = ps.get_topic(this, topic_name, &result, y);
+ op_ret = ps.get_topic(this, topic_name, result, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl;
return;
return;
}
const RGWPubSub ps(driver, s->owner.get_id().tenant);
- op_ret = ps.get_topic(this, topic_name, &result, y);
+ op_ret = ps.get_topic(this, topic_name, result, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl;
return;
if(configurations.list.empty()) {
// get all topics on a bucket
rgw_pubsub_bucket_topics bucket_topics;
- op_ret = b.get_topics(this, &bucket_topics, y);
+ op_ret = b.get_topics(this, bucket_topics, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get list of topics from bucket '" << bucket_name << "', ret=" << op_ret << dendl;
return;
// get topic information. destination information is stored in the topic
rgw_pubsub_topic topic_info;
- op_ret = ps.get_topic(this, topic_name, &topic_info, y);
+ op_ret = ps.get_topic(this, topic_name, topic_info, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get topic '" << topic_name << "', ret=" << op_ret << dendl;
return;
// get all topics on a bucket
rgw_pubsub_bucket_topics bucket_topics;
- op_ret = b.get_topics(this, &bucket_topics, y);
+ op_ret = b.get_topics(this, bucket_topics, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get list of topics from bucket '" << bucket_name << "', ret=" << op_ret << dendl;
return;
// get all topics on a bucket
rgw_pubsub_bucket_topics bucket_topics;
- op_ret = b.get_topics(this, &bucket_topics, y);
+ op_ret = b.get_topics(this, bucket_topics, y);
if (op_ret < 0) {
ldpp_dout(this, 1) << "failed to get list of topics from bucket '" << bucket_name << "', ret=" << op_ret << dendl;
return;