summaryrefslogtreecommitdiffstats
path: root/src/crimson/crush/CrushLocation.h
blob: 9dc954672ab3b7553562c1207d44ecf6556348df (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
// -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
// vim: ts=8 sw=2 smarttab
#pragma once

#include <iosfwd>
#include <map>
#include <string>
#if FMT_VERSION >= 90000
#include <fmt/ostream.h>
#endif

#include <seastar/core/seastar.hh>

namespace crimson::crush {

class CrushLocation {
public:
  explicit CrushLocation() {
  }

  seastar::future<> update_from_conf();  ///< refresh from config
  seastar::future<> init_on_startup();
  seastar::future<> update_from_hook();  ///< call hook, if present

  std::multimap<std::string, std::string> get_location() const;

private:
  void _parse(const std::string& s);
  std::multimap<std::string, std::string> loc;
};

std::ostream& operator<<(std::ostream& os, const CrushLocation& loc);
}

#if FMT_VERSION >= 90000
template <> struct fmt::formatter<crimson::crush::CrushLocation> : fmt::ostream_formatter {};
#endif