]>
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
15 int RGWFrontendConfig::parse_config(const string
& config
,
16 std::multimap
<string
, string
>& config_map
)
18 for (auto& entry
: get_str_vec(config
, " ")) {
22 if (framework
.empty()) {
24 dout(0) << "framework: " << framework
<< dendl
;
28 ssize_t pos
= entry
.find('=');
30 dout(0) << "framework conf key: " << entry
<< dendl
;
31 config_map
.emplace(std::move(entry
), "");
35 int ret
= parse_key_value(entry
, key
, val
);
37 cerr
<< "ERROR: can't parse " << entry
<< std::endl
;
41 dout(0) << "framework conf key: " << key
<< ", val: " << val
<< dendl
;
42 config_map
.emplace(std::move(key
), std::move(val
));
48 void RGWFrontendConfig::set_default_config(RGWFrontendConfig
& def_conf
)
50 const auto& def_conf_map
= def_conf
.get_config_map();
52 for (auto& entry
: def_conf_map
) {
53 if (config_map
.find(entry
.first
) == config_map
.end()) {
54 config_map
.emplace(entry
.first
, entry
.second
);
59 std::optional
<string
> RGWFrontendConfig::get_val(const std::string
& key
)
61 auto iter
= config_map
.find(key
);
62 if (iter
== config_map
.end()) {
69 bool RGWFrontendConfig::get_val(const string
& key
, const string
& def_val
,
72 auto iter
= config_map
.find(key
);
73 if (iter
== config_map
.end()) {
82 bool RGWFrontendConfig::get_val(const string
& key
, int def_val
, int *out
)
85 bool found
= get_val(key
, "", &str
);
91 *out
= strict_strtol(str
.c_str(), 10, &err
);
93 cerr
<< "error parsing int: " << str
<< ": " << err
<< std::endl
;
99 void RGWProcessFrontend::stop()
101 pprocess
->close_fd();
102 thread
->kill(SIGUSR1
);