]>
git.proxmox.com Git - ceph.git/blob - ceph/src/common/config_values.h
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
11 #include "common/entity_name.h"
12 #include "common/options.h"
13 #include "log/SubsystemMap.h"
14 #include "msg/msg_types.h"
16 // @c ConfigValues keeps track of mappings from the config names to their values,
17 // debug logging settings, and some other "unnamed" settings, like entity name of
20 using values_t
= std::map
<std::string_view
, std::map
<int32_t,Option::value_t
>>;
22 // for populating md_config_impl::legacy_values in ctor
23 friend struct md_config_t
;
29 ceph::logging::SubsystemMap subsys
;
30 bool no_mon_config
= false;
31 // Set of configuration options that have changed since the last
33 using changed_set_t
= std::set
<std::string
>;
34 changed_set_t changed
;
36 // This macro block defines C members of the md_config_t struct
37 // corresponding to the definitions in legacy_config_opts.h.
38 // These C members are consumed by code that was written before
39 // the new options.cc infrastructure: all newer code should
40 // be consume options via explicit get() rather than C members.
41 #define OPTION_OPT_INT(name) int64_t name;
42 #define OPTION_OPT_LONGLONG(name) int64_t name;
43 #define OPTION_OPT_STR(name) std::string name;
44 #define OPTION_OPT_DOUBLE(name) double name;
45 #define OPTION_OPT_FLOAT(name) double name;
46 #define OPTION_OPT_BOOL(name) bool name;
47 #define OPTION_OPT_ADDR(name) entity_addr_t name;
48 #define OPTION_OPT_ADDRVEC(name) entity_addrvec_t name;
49 #define OPTION_OPT_U32(name) uint64_t name;
50 #define OPTION_OPT_U64(name) uint64_t name;
51 #define OPTION_OPT_UUID(name) uuid_d name;
52 #define OPTION_OPT_SIZE(name) uint64_t name;
53 #define OPTION(name, ty) \
56 #define SAFE_OPTION(name, ty) \
59 #include "common/options/legacy_config_opts.h"
61 #undef OPTION_OPT_LONGLONG
63 #undef OPTION_OPT_DOUBLE
64 #undef OPTION_OPT_FLOAT
65 #undef OPTION_OPT_BOOL
66 #undef OPTION_OPT_ADDR
67 #undef OPTION_OPT_ADDRVEC
70 #undef OPTION_OPT_UUID
75 enum set_value_result_t
{
81 * @return true if changed, false otherwise
83 set_value_result_t
set_value(std::string_view key
,
84 Option::value_t
&& value
,
86 int rm_val(const std::string_view key
, int level
);
87 void set_logging(int which
, const char* val
);
89 * @param level the level of the setting, -1 for the one with the
92 std::pair
<Option::value_t
, bool> get_value(const std::string_view name
,
94 template<typename Func
> void for_each(Func
&& func
) const {
95 for (const auto& [name
,configs
] : values
) {
99 bool contains(const std::string_view key
) const;