mirror of
https://github.com/ceph/ceph
synced 2025-01-19 17:41:39 +00:00
crush: add const string& versions of accessors
Signed-off-by: Sage Weil <sage@inktank.com>
This commit is contained in:
parent
babef41a06
commit
9636991376
@ -152,19 +152,25 @@ public:
|
||||
// item/bucket names
|
||||
bool name_exists(const char *s) {
|
||||
string name(s);
|
||||
return name_exists(name);
|
||||
}
|
||||
bool name_exists(const string& name) {
|
||||
build_rmaps();
|
||||
return name_rmap.count(name);
|
||||
}
|
||||
bool item_exists(int i) {
|
||||
return name_map.count(i);
|
||||
}
|
||||
int get_item_id(const char *s) {
|
||||
string name(s);
|
||||
int get_item_id(const string& name) {
|
||||
build_rmaps();
|
||||
if (name_rmap.count(name))
|
||||
return name_rmap[name];
|
||||
return 0; /* hrm */
|
||||
}
|
||||
int get_item_id(const char *s) {
|
||||
string name(s);
|
||||
return get_item_id(name);
|
||||
}
|
||||
const char *get_item_name(int t) const {
|
||||
std::map<int,string>::const_iterator p = name_map.find(t);
|
||||
if (p != name_map.end())
|
||||
@ -173,6 +179,9 @@ public:
|
||||
}
|
||||
void set_item_name(int i, const char *n) {
|
||||
string name(n);
|
||||
set_item_name(i, name);
|
||||
}
|
||||
void set_item_name(int i, const string& name) {
|
||||
name_map[i] = name;
|
||||
if (have_rmaps)
|
||||
name_rmap[name] = i;
|
||||
|
Loading…
Reference in New Issue
Block a user