summaryrefslogtreecommitdiffstats
path: root/src/mon/MonMap.h
diff options
context:
space:
mode:
authorSage Weil <sage@inktank.com>2012-05-22 16:05:36 +0200
committerSage Weil <sage@inktank.com>2012-05-22 16:05:36 +0200
commitd7a8084b4c6f50d019929894ac5b00c703304d66 (patch)
treed27365021b194b3b9040cc78940372951ea75538 /src/mon/MonMap.h
parentdoc: document range of methods for cluster creation, expansion (diff)
downloadceph-d7a8084b4c6f50d019929894ac5b00c703304d66.tar.xz
ceph-d7a8084b4c6f50d019929894ac5b00c703304d66.zip
monmap: calc_ranks() on rename()
This is simpler than ensuring we track all the right invariants. Signed-off-by: Sage Weil <sage@inktank.com>
Diffstat (limited to 'src/mon/MonMap.h')
-rw-r--r--src/mon/MonMap.h16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/mon/MonMap.h b/src/mon/MonMap.h
index 77f17b230b6..f2f6c6439c2 100644
--- a/src/mon/MonMap.h
+++ b/src/mon/MonMap.h
@@ -103,6 +103,14 @@ class MonMap {
calc_ranks();
}
+ void rename(string oldname, string newname) {
+ assert(contains(oldname));
+ assert(!contains(newname));
+ mon_addr[newname] = mon_addr[oldname];
+ mon_addr.erase(oldname);
+ calc_ranks();
+ }
+
bool contains(const string& name) {
return mon_addr.count(name);
}
@@ -147,14 +155,6 @@ class MonMap {
return true;
}
- void rename(string oldname, string newname) {
- assert(contains(oldname));
- assert(!contains(newname));
- mon_addr[newname] = mon_addr[oldname];
- mon_addr.erase(oldname);
- addr_name[mon_addr[newname]] = newname;
- }
-
const entity_addr_t& get_addr(const string& n) {
assert(mon_addr.count(n));
return mon_addr[n];