]>
git.proxmox.com Git - ceph.git/blob - ceph/src/rgw/rgw_frontend.cc
1 // -*- mode:C++; tab-width:8; c-basic-offset:2; indent-tabs-mode:t -*-
2 // vim: ts=8 sw=2 smarttab ft=cpp
6 #include "rgw_frontend.h"
7 #include "include/str_list.h"
9 #include "include/ceph_assert.h"
12 #define dout_context g_ceph_context
13 #define dout_subsys ceph_subsys_rgw
17 int RGWFrontendConfig::parse_config(const string
& config
,
18 std::multimap
<string
, string
>& config_map
)
20 for (auto& entry
: get_str_vec(config
, " ")) {
24 if (framework
.empty()) {
26 dout(0) << "framework: " << framework
<< dendl
;
30 ssize_t pos
= entry
.find('=');
32 dout(0) << "framework conf key: " << entry
<< dendl
;
33 config_map
.emplace(std::move(entry
), "");
37 int ret
= parse_key_value(entry
, key
, val
);
39 cerr
<< "ERROR: can't parse " << entry
<< std::endl
;
43 dout(0) << "framework conf key: " << key
<< ", val: " << val
<< dendl
;
44 config_map
.emplace(std::move(key
), std::move(val
));
50 void RGWFrontendConfig::set_default_config(RGWFrontendConfig
& def_conf
)
52 const auto& def_conf_map
= def_conf
.get_config_map();
54 for (auto& entry
: def_conf_map
) {
55 if (config_map
.find(entry
.first
) == config_map
.end()) {
56 config_map
.emplace(entry
.first
, entry
.second
);
61 std::optional
<string
> RGWFrontendConfig::get_val(const std::string
& key
)
63 auto iter
= config_map
.find(key
);
64 if (iter
== config_map
.end()) {
71 bool RGWFrontendConfig::get_val(const string
& key
, const string
& def_val
,
74 auto iter
= config_map
.find(key
);
75 if (iter
== config_map
.end()) {
84 bool RGWFrontendConfig::get_val(const string
& key
, int def_val
, int *out
)
87 bool found
= get_val(key
, "", &str
);
93 *out
= strict_strtol(str
.c_str(), 10, &err
);
95 cerr
<< "error parsing int: " << str
<< ": " << err
<< std::endl
;
101 void RGWProcessFrontend::stop()
103 pprocess
->close_fd();
104 thread
->kill(SIGUSR1
);