Commit b20f0ad8 authored by Dominik Charousset's avatar Dominik Charousset

Fix config parameter names

parent b78adaca
...@@ -88,7 +88,7 @@ public: ...@@ -88,7 +88,7 @@ public:
manager_ = &parent.manager(); manager_ = &parent.manager();
size_t workers; size_t workers;
if (auto workers_cfg = get_if<size_t>(&system_->config(), if (auto workers_cfg = get_if<size_t>(&system_->config(),
"middleman.workers")) "caf.middleman.workers"))
workers = *workers_cfg; workers = *workers_cfg;
else else
workers = std::min(3u, std::thread::hardware_concurrency() / 4u) + 1; workers = std::min(3u, std::thread::hardware_concurrency() / 4u) + 1;
......
...@@ -101,12 +101,12 @@ public: ...@@ -101,12 +101,12 @@ public:
manager_ = &parent; manager_ = &parent;
auto& cfg = system().config(); auto& cfg = system().config();
max_consecutive_reads_ = get_or(this->system().config(), max_consecutive_reads_ = get_or(this->system().config(),
"middleman.max-consecutive-reads", "caf.middleman.max-consecutive-reads",
defaults::middleman::max_consecutive_reads); defaults::middleman::max_consecutive_reads);
auto max_header_bufs = get_or(cfg, "middleman.max-header-buffers", auto max_header_bufs = get_or(cfg, "caf.middleman.max-header-buffers",
defaults::middleman::max_header_buffers); defaults::middleman::max_header_buffers);
header_bufs_.reserve(max_header_bufs); header_bufs_.reserve(max_header_bufs);
auto max_payload_bufs = get_or(cfg, "middleman.max-payload-buffers", auto max_payload_bufs = get_or(cfg, "caf.middleman.max-payload-buffers",
defaults::middleman::max_payload_buffers); defaults::middleman::max_payload_buffers);
payload_bufs_.reserve(max_payload_bufs); payload_bufs_.reserve(max_payload_bufs);
if (auto err = next_layer_.init(*this)) if (auto err = next_layer_.init(*this))
......
...@@ -222,7 +222,7 @@ error application::handle_handshake(packet_writer&, header hdr, ...@@ -222,7 +222,7 @@ error application::handle_handshake(packet_writer&, header hdr,
return err; return err;
if (!peer_id || app_ids.empty()) if (!peer_id || app_ids.empty())
return ec::invalid_handshake; return ec::invalid_handshake;
auto ids = get_or(system().config(), "middleman.app-identifiers", auto ids = get_or(system().config(), "caf.middleman.app-identifiers",
basp::application::default_app_ids()); basp::application::default_app_ids());
auto predicate = [=](const std::string& x) { auto predicate = [=](const std::string& x) {
return std::find(ids.begin(), ids.end(), x) != ids.end(); return std::find(ids.begin(), ids.end(), x) != ids.end();
...@@ -381,7 +381,7 @@ error application::handle_down_message(packet_writer&, header received_hdr, ...@@ -381,7 +381,7 @@ error application::handle_down_message(packet_writer&, header received_hdr,
error application::generate_handshake(byte_buffer& buf) { error application::generate_handshake(byte_buffer& buf) {
binary_serializer sink{&executor_, buf}; binary_serializer sink{&executor_, buf};
return sink(system().node(), return sink(system().node(),
get_or(system().config(), "middleman.app-identifiers", get_or(system().config(), "caf.middleman.app-identifiers",
application::default_app_ids())); application::default_app_ids()));
} }
......
...@@ -47,8 +47,9 @@ tcp::~tcp() { ...@@ -47,8 +47,9 @@ tcp::~tcp() {
} }
error tcp::init() { error tcp::init() {
uint16_t conf_port = get_or<uint16_t>( uint16_t conf_port = get_or<uint16_t>(mm_.system().config(),
mm_.system().config(), "middleman.tcp-port", defaults::middleman::tcp_port); "caf.middleman.tcp-port",
defaults::middleman::tcp_port);
ip_endpoint ep; ip_endpoint ep;
auto local_address = std::string("[::]:") + std::to_string(conf_port); auto local_address = std::string("[::]:") + std::to_string(conf_port);
if (auto err = detail::parse(local_address, ep)) if (auto err = detail::parse(local_address, ep))
......
...@@ -46,7 +46,7 @@ middleman::~middleman() { ...@@ -46,7 +46,7 @@ middleman::~middleman() {
} }
void middleman::start() { void middleman::start() {
if (!get_or(config(), "middleman.manual-multiplexing", false)) { if (!get_or(config(), "caf.middleman.manual-multiplexing", false)) {
auto mpx = mpx_; auto mpx = mpx_;
auto sys_ptr = &system(); auto sys_ptr = &system();
mpx_thread_ = std::thread{[mpx, sys_ptr] { mpx_thread_ = std::thread{[mpx, sys_ptr] {
...@@ -75,11 +75,11 @@ void middleman::init(actor_system_config& cfg) { ...@@ -75,11 +75,11 @@ void middleman::init(actor_system_config& cfg) {
CAF_LOG_ERROR("mgr->init() failed: " << err); CAF_LOG_ERROR("mgr->init() failed: " << err);
CAF_RAISE_ERROR("mpx->init() failed"); CAF_RAISE_ERROR("mpx->init() failed");
} }
if (auto node_uri = get_if<uri>(&cfg, "middleman.this-node")) { if (auto node_uri = get_if<uri>(&cfg, "caf.middleman.this-node")) {
auto this_node = make_node_id(std::move(*node_uri)); auto this_node = make_node_id(std::move(*node_uri));
sys_.node_.swap(this_node); sys_.node_.swap(this_node);
} else { } else {
CAF_RAISE_ERROR("no valid entry for middleman.this-node found"); CAF_RAISE_ERROR("no valid entry for caf.middleman.this-node found");
} }
for (auto& backend : backends_) for (auto& backend : backends_)
if (auto err = backend->init()) { if (auto err = backend->init()) {
...@@ -96,8 +96,16 @@ void* middleman::subtype_ptr() { ...@@ -96,8 +96,16 @@ void* middleman::subtype_ptr() {
return this; return this;
} }
void middleman::add_module_options(actor_system_config&) { void middleman::add_module_options(actor_system_config& cfg) {
// nop config_option_adder{cfg.custom_options(), "caf.middleman"}
.add<std::vector<std::string>>("app-identifiers",
"valid application identifiers of this node")
.add<uri>("this-node", "locator of this CAF node")
.add<size_t>("max-consecutive-reads",
"max. number of consecutive reads per broker")
.add<bool>("manual-multiplexing",
"disables background activity of the multiplexer")
.add<size_t>("workers", "number of deserialization workers");
} }
expected<endpoint_manager_ptr> middleman::connect(const uri& locator) { expected<endpoint_manager_ptr> middleman::connect(const uri& locator) {
......
...@@ -61,7 +61,7 @@ template <class Node> ...@@ -61,7 +61,7 @@ template <class Node>
struct config : actor_system_config { struct config : actor_system_config {
config() { config() {
Node this_node; Node this_node;
put(content, "middleman.this-node", this_node()); put(content, "caf.middleman.this-node", this_node());
load<middleman, backend::tcp>(); load<middleman, backend::tcp>();
} }
}; };
......
...@@ -47,7 +47,7 @@ template <class Node> ...@@ -47,7 +47,7 @@ template <class Node>
struct config : actor_system_config { struct config : actor_system_config {
config() { config() {
Node this_node; Node this_node;
put(content, "middleman.this-node", this_node()); put(content, "caf.middleman.this-node", this_node());
load<middleman, backend::test>(); load<middleman, backend::test>();
} }
}; };
......
...@@ -56,7 +56,7 @@ size_t fetch_size(variant<size_t, sec> x) { ...@@ -56,7 +56,7 @@ size_t fetch_size(variant<size_t, sec> x) {
struct config : actor_system_config { struct config : actor_system_config {
config() { config() {
put(content, "middleman.this-node", unbox(make_uri("test:earth"))); put(content, "caf.middleman.this-node", unbox(make_uri("test:earth")));
load<middleman, backend::test>(); load<middleman, backend::test>();
} }
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment