return -ret;
}
+ list<string> realms;
+ ret = store->list_realms(realms);
+ if (ret < 0) {
+ cerr << "failed to list realms: " << cpp_strerror(-ret) << std::endl;
+ return -ret;
+ }
+ for (list<string>::iterator iter = realms.begin(); iter != realms.end(); ++iter)
+ {
+ RGWRealm realm(*iter);
+ ret = realm.init(g_ceph_context, store);
+ if (ret < 0) {
+ cerr << "failed to init realm: " << cpp_strerror(-ret) << std::endl;
+ return -ret;
+ }
+ zonegroupmap.update(realm);
+ }
+
list<string> zonegroups;
ret = store->list_zonegroups(zonegroups);
if (ret < 0) {
return 0;
}
+int RGWZoneGroupMap::update(RGWRealm& realm)
+{
+ Mutex::Locker l(lock);
+ realms[realm.get_id()] = realm;
+ return 0;
+}
+
int RGWZoneGroupMap::get_master_zonegroup(const string& current_period,
RGWZoneGroup& zonegroup)
{
WRITE_CLASS_ENCODER(RGWPeriodMap)
class RGWRealm;
-
struct RGWZoneGroupMap {
Mutex lock;
int store(CephContext *cct, RGWRados *store);
int update(RGWZoneGroup& zonegroup);
-
+ int update(RGWRealm& realm);
+
int get_master_zonegroup(const string& current_period,
RGWZoneGroup& master_zonegroup);
public:
RGWRealm() {}
- RGWRealm(const string& _id, const string& _name) : RGWSystemMetaObj(_id, _name) {}
+ RGWRealm(const string& _id, const string& _name = "") : RGWSystemMetaObj(_id, _name) {}
RGWRealm(CephContext *_cct, RGWRados *_store): RGWSystemMetaObj(_cct, _store) {}
RGWRealm(const string& _name, CephContext *_cct, RGWRados *_store): RGWSystemMetaObj(_name, _cct, _store){}