return ret;
}
}
- ret = set_current_period(period.get_id());
+ ret = set_current_period(period);
if (ret < 0) {
return ret;
}
return realm_info_oid_prefix;
}
-int RGWRealm::set_current_period(const string& period_id) {
- /* check to see period id is valid */
- RGWPeriod new_current(period_id);
- int ret = new_current.init(cct, store, id, name);
- if (ret < 0) {
- ldout(cct, 0) << "Error init new period id " << period_id << " : " << cpp_strerror(-ret) << dendl;
- return ret;
- }
- new_current.set_predecessor(current_period);
+int RGWRealm::set_current_period(RGWPeriod& period)
+{
- ret = new_current.store_info(false);
- if (ret < 0) {
- return ret;
- }
- current_period = period_id;
- ret = update();
+ current_period = period.get_id();
+
+ int ret = update();
if (ret < 0) {
ldout(cct, 0) << "ERROR: period update: " << cpp_strerror(-ret) << dendl;
return ret;
}
- ret = new_current.reflect();
+ ret = period.reflect();
if (ret < 0) {
ldout(cct, 0) << "ERROR: period.reflect(): " << cpp_strerror(-ret) << dendl;
return ret;
return r;
}
// set as current period
- r = realm.set_current_period(id);
+ r = realm.set_current_period(*this);
if (r < 0) {
lderr(cct) << "failed to update realm's current period: "
<< cpp_strerror(-r) << dendl;
const string& get_current_period() const {
return current_period;
}
- int set_current_period(const string& period_id);
+ int set_current_period(RGWPeriod& period);
string get_control_oid();
/// send a notify on the realm control object