]> git.proxmox.com Git - ceph.git/blob - ceph/src/crush/CrushLocation.h
import 15.2.0 Octopus source
[ceph.git] / ceph / src / crush / CrushLocation.h
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 <iosfwd>
8 #include <map>
9 #include <string>
10
11 #include "common/ceph_mutex.h"
12 #include "include/common_fwd.h"
13
14 namespace TOPNSPC::crush {
15
16 class CrushLocation {
17 public:
18 explicit CrushLocation(CephContext *c) : cct(c) {
19 init_on_startup();
20 }
21
22 int update_from_conf(); ///< refresh from config
23 int update_from_hook(); ///< call hook, if present
24 int init_on_startup();
25
26 std::multimap<std::string,std::string> get_location() const;
27
28 private:
29 int _parse(const std::string& s);
30 CephContext *cct;
31 std::multimap<std::string,std::string> loc;
32 mutable ceph::mutex lock = ceph::make_mutex("CrushLocation");
33 };
34
35 std::ostream& operator<<(std::ostream& os, const CrushLocation& loc);
36 }
37 #endif