]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*- |
2 | // vim: ts=8 sw=2 smarttab | |
3 | ||
4 | #ifndef CEPH_CRUSH_LOCATION_H | |
5 | #define CEPH_CRUSH_LOCATION_H | |
6 | ||
7 | #include <map> | |
8 | #include <mutex> | |
9 | #include <string> | |
10 | ||
11 | class CephContext; | |
12 | ||
13 | class CrushLocation { | |
14 | CephContext *cct; | |
15 | std::multimap<std::string,std::string> loc; | |
16 | std::mutex lock; | |
17 | ||
18 | int _parse(const std::string& s); | |
19 | ||
20 | public: | |
21 | CrushLocation(CephContext *c) : cct(c) { | |
224ce89b | 22 | init_on_startup(); |
7c673cae FG |
23 | } |
24 | ||
25 | int update_from_conf(); ///< refresh from config | |
26 | int update_from_hook(); ///< call hook, if present | |
27 | int init_on_startup(); | |
28 | ||
29 | std::multimap<std::string,std::string> get_location() { | |
30 | std::lock_guard<std::mutex> l(lock); | |
31 | return loc; | |
32 | } | |
33 | }; | |
34 | ||
35 | #endif |