Commit 2131e2cb authored by Dominik Charousset's avatar Dominik Charousset

Drop legacy .ini support, scope config parameters

parent 1d4dcede
# This file shows all possible parameters with defaults. For some values, CAF # This file shows all possible parameters with defaults. For some values, CAF
# computes a value at runtime if the configuration does not provide a value. For # computes a value at runtime if the configuration does not provide a value. For
# example, "scheduler.max-threads" has no hard-coded default and instead adjusts # example, "caf.scheduler.max-threads" has no hard-coded default and instead
# to the number of cores available. # adjusts to the number of cores available.
caf {
# when using the default scheduler # Parameters selecting a default scheduler.
scheduler { scheduler {
# accepted alternative: "sharing" # Use the work stealing implementation. Accepted alternative: "sharing".
policy="stealing" policy = "stealing"
# configures whether the scheduler generates profiling output # Maximum number of messages actors can consume in single run (int64 max).
enable-profiling=false max-throughput = 9223372036854775807
# forces a fixed number of threads if set # # Maximum number of threads for the scheduler. No hardcoded default.
# max-threads=... (detected at runtime) # max-threads = ... (detected at runtime)
# maximum number of messages actors can consume in one run (int64 max) }
max-throughput=9223372036854775807 # Prameters for the work stealing scheduler. Only takes effect if
# measurement resolution in milliseconds (only if profiling is enabled) # caf.scheduler.policy is set to "stealing".
profiling-resolution=100ms work-stealing {
# output file for profiler data (only if profiling is enabled) # Number of zero-sleep-interval polling attempts.
profiling-output-file="/dev/null" aggressive-poll-attempts = 100
} # Frequency of steal attempts during aggressive polling.
aggressive-steal-interval = 10
# when using "stealing" as scheduler policy # Number of moderately aggressive polling attempts.
work-stealing { moderate-poll-attempts = 500
# number of zero-sleep-interval polling attempts # Frequency of steal attempts during moderate polling.
aggressive-poll-attempts=100 moderate-steal-interval = 5
# frequency of steal attempts during aggressive polling # Sleep interval between poll attempts.
aggressive-steal-interval=10 moderate-sleep-duration = 50us
# number of moderately aggressive polling attempts # Frequency of steal attempts during relaxed polling.
moderate-poll-attempts=500 relaxed-steal-interval = 1
# frequency of steal attempts during moderate polling # Sleep interval between poll attempts.
moderate-steal-interval=5 relaxed-sleep-duration = 10ms
# sleep interval between poll attempts }
moderate-sleep-duration=50us # Parameters for the I/O module.
# frequency of steal attempts during relaxed polling middleman {
relaxed-steal-interval=1 # Configures whether MMs try to span a full mesh.
# sleep interval between poll attempts enable-automatic-connections = false
relaxed-sleep-duration=10ms # Application identifiers of this node, prevents connection to other CAF
} # instances with incompatible identifiers.
app-identifiers = ["generic-caf-app"]
# when loading io::middleman # Maximum number of consecutive I/O reads per broker.
middleman { max-consecutive-reads = 50
# configures whether MMs try to span a full mesh # Heartbeat message interval in ms (0 disables heartbeating).
enable-automatic-connections=false heartbeat-interval = 0ms
# application identifier of this node, prevents connection to other CAF # Configures whether the MM attaches its internal utility actors to the
# instances with different identifier
app-identifier=""
# maximum number of consecutive I/O reads per broker
max-consecutive-reads=50
# heartbeat message interval in ms (0 disables heartbeating)
heartbeat-interval=0ms
# configures whether the MM attaches its internal utility actors to the
# scheduler instead of dedicating individual threads (needed only for # scheduler instead of dedicating individual threads (needed only for
# deterministic testing) # deterministic testing).
attach-utility-actors=false attach-utility-actors = false
# configures whether the MM starts a background thread for I/O activity, # Configures whether the MM starts a background thread for I/O activity.
# setting this to true allows fully deterministic execution in unit test and # Setting this to true allows fully deterministic execution in unit test and
# requires the user to trigger I/O manually # requires the user to trigger I/O manually.
manual-multiplexing=false manual-multiplexing = false
# disables communication via TCP # # Configures how many background workers are spawned for deserialization.
disable-tcp=false # # No hardcoded default.
# enable communication via UDP # workers = ... (detected at runtime)
enable-udp=false }
# configures how many background workers are spawned for deserialization, # Parameters for logging.
# by default CAF uses 1-4 workers depending on the number of cores logger {
# workers=... (detected at runtime) # # Note: File logging is disabled unless a 'file' section exists that
} # # contains a setting for 'verbosity'.
# file {
# when compiling with logging enabled # # File name template for output log files.
logger { # path = "actor_log_[PID]_[TIMESTAMP]_[NODE].log"
# file name template for output log file files (empty string disables logging) # # Format for rendering individual log file entries.
file-name="actor_log_[PID]_[TIMESTAMP]_[NODE].log" # format = "%r %c %p %a %t %C %M %F:%L %m%n"
# format for rendering individual log file entries # # Minimum severity of messages that are written to the log. One of:
file-format="%r %c %p %a %t %C %M %F:%L %m%n" # # 'quiet', 'error', 'warning', 'info', 'debug', or 'trace'.
# configures the minimum severity of messages that are written to the log file # verbosity = "trace"
# (quiet|error|warning|info|debug|trace) # # A list of components to exclude in file output.
file-verbosity="trace" # excluded-components = []
# mode for console log output generation (none|colored|uncolored) # }
console="none" # # Note: Console output is disabled unless a 'console' section exists that
# format for printing individual log entries to the console # # contains a setting for 'verbosity'.
console-format="%m" # console {
# configures the minimum severity of messages that are written to the console # # Enabled colored output when writing to a TTY if set to true.
# (quiet|error|warning|info|debug|trace) # colored = true
console-verbosity="trace" # # Format for printing log lines (implicit newline at the end).
# excludes listed components from logging (list of strings) # format = "[%c:%p] %d %m"
component-blacklist=[] # # Minimum severity of messages that are written to the console. One of:
# # 'quiet', 'error', 'warning', 'info', 'debug', or 'trace'.
# verbosity = "trace"
# # A list of components to exclude in console output.
# excluded-components = []
# }
}
} }
...@@ -326,10 +326,6 @@ private: ...@@ -326,10 +326,6 @@ private:
actor_system_config& set_impl(string_view name, config_value value); actor_system_config& set_impl(string_view name, config_value value);
error extract_config_file_path(string_list& args); error extract_config_file_path(string_list& args);
/// Adjusts the content of the configuration, e.g., for ensuring backwards
/// compatibility with older options.
error adjust_content();
}; };
/// Returns all user-provided configuration parameters. /// Returns all user-provided configuration parameters.
......
...@@ -68,33 +68,19 @@ constexpr auto relaxed_sleep_duration = timespan{10'000'000}; ...@@ -68,33 +68,19 @@ constexpr auto relaxed_sleep_duration = timespan{10'000'000};
} // namespace caf::defaults::work_stealing } // namespace caf::defaults::work_stealing
namespace caf::defaults::logger { namespace caf::defaults::logger::file {
constexpr auto default_log_level = string_view { constexpr auto format = string_view{"%r %c %p %a %t %C %M %F:%L %m%n"};
#if CAF_LOG_LEVEL == CAF_LOG_LEVEL_TRACE constexpr auto path = string_view{"actor_log_[PID]_[TIMESTAMP]_[NODE].log"};
"trace"
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_DEBUG } // namespace caf::defaults::logger::file
"debug"
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_INFO namespace caf::defaults::logger::console {
"info"
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_WARNING constexpr auto colored = true;
"warning" constexpr auto format = string_view{"[%c:%p] %d %m"};
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_ERROR
"error" } // namespace caf::defaults::logger::console
#else
"quiet"
#endif
};
constexpr auto console = string_view{"none"};
constexpr auto console_format = string_view{"%m"};
constexpr auto console_verbosity = default_log_level;
constexpr auto file_format = string_view{"%r %c %p %a %t %C %M %F:%L %m%n"};
constexpr auto file_verbosity = default_log_level;
constexpr auto file_name
= string_view{"actor_log_[PID]_[TIMESTAMP]_[NODE].log"};
} // namespace caf::defaults::logger
namespace caf::defaults::middleman { namespace caf::defaults::middleman {
......
...@@ -340,8 +340,15 @@ private: ...@@ -340,8 +340,15 @@ private:
// Configures verbosity and output generation. // Configures verbosity and output generation.
config cfg_; config cfg_;
// Filters events by component name. // Filters events by component name before enqueuing a log event. Union of
std::vector<std::string> component_blacklist; // file_filter_ and console_filter_ if both outputs are enabled.
std::vector<std::string> global_filter_;
// Filters events by component name for file output.
std::vector<std::string> file_filter_;
// Filters events by component name for console output.
std::vector<std::string> console_filter_;
// References the parent system. // References the parent system.
actor_system& system_; actor_system& system_;
......
...@@ -320,7 +320,7 @@ actor_system::actor_system(actor_system_config& cfg) ...@@ -320,7 +320,7 @@ actor_system::actor_system(actor_system_config& cfg)
}; };
sched_conf sc = stealing; sched_conf sc = stealing;
namespace sr = defaults::scheduler; namespace sr = defaults::scheduler;
auto sr_policy = get_or(cfg, "scheduler.policy", sr::policy); auto sr_policy = get_or(cfg, "caf.scheduler.policy", sr::policy);
if (sr_policy == "sharing") if (sr_policy == "sharing")
sc = sharing; sc = sharing;
else if (sr_policy == "testing") else if (sr_policy == "testing")
......
...@@ -62,29 +62,30 @@ actor_system_config::actor_system_config() ...@@ -62,29 +62,30 @@ actor_system_config::actor_system_config()
stream_credit_round_interval = defaults::stream::credit_round_interval; stream_credit_round_interval = defaults::stream::credit_round_interval;
// fill our options vector for creating config file and CLI parsers // fill our options vector for creating config file and CLI parsers
using std::string; using std::string;
using string_list = std::vector<string>;
opt_group{custom_options_, "global"} opt_group{custom_options_, "global"}
.add<bool>("help,h?", "print help text to STDERR and exit") .add<bool>("help,h?", "print help text to STDERR and exit")
.add<bool>("long-help", "print long help text to STDERR and exit") .add<bool>("long-help", "print long help text to STDERR and exit")
.add<bool>("dump-config", "print configuration to STDERR and exit") .add<bool>("dump-config", "print configuration to STDERR and exit")
.add<string>(config_file_path, "config-file", .add<string>(config_file_path, "config-file",
"set config file (default: caf-application.conf)"); "set config file (default: caf-application.conf)");
opt_group{custom_options_, "stream"} opt_group{custom_options_, "caf.stream"}
.add<timespan>(stream_desired_batch_complexity, "desired-batch-complexity", .add<timespan>(stream_desired_batch_complexity, "desired-batch-complexity",
"processing time per batch") "processing time per batch")
.add<timespan>(stream_max_batch_delay, "max-batch-delay", .add<timespan>(stream_max_batch_delay, "max-batch-delay",
"maximum delay for partial batches") "maximum delay for partial batches")
.add<timespan>(stream_credit_round_interval, "credit-round-interval", .add<timespan>(stream_credit_round_interval, "credit-round-interval",
"time between emitting credit") "time between emitting credit")
.add<std::string>("credit-policy", .add<string>("credit-policy",
"selects an algorithm for credit computation"); "selects an algorithm for credit computation");
opt_group{custom_options_, "scheduler"} opt_group{custom_options_, "caf.scheduler"}
.add<std::string>("policy", "'stealing' (default) or 'sharing'") .add<string>("policy", "'stealing' (default) or 'sharing'")
.add<size_t>("max-threads", "maximum number of worker threads") .add<size_t>("max-threads", "maximum number of worker threads")
.add<size_t>("max-throughput", "nr. of messages actors can consume per run") .add<size_t>("max-throughput", "nr. of messages actors can consume per run")
.add<bool>("enable-profiling", "enables profiler output") .add<bool>("enable-profiling", "enables profiler output")
.add<timespan>("profiling-resolution", "data collection rate") .add<timespan>("profiling-resolution", "data collection rate")
.add<string>("profiling-output-file", "output file for the profiler"); .add<string>("profiling-output-file", "output file for the profiler");
opt_group(custom_options_, "work-stealing") opt_group(custom_options_, "caf.work-stealing")
.add<size_t>("aggressive-poll-attempts", "nr. of aggressive steal attempts") .add<size_t>("aggressive-poll-attempts", "nr. of aggressive steal attempts")
.add<size_t>("aggressive-steal-interval", .add<size_t>("aggressive-steal-interval",
"frequency of aggressive steal attempts") "frequency of aggressive steal attempts")
...@@ -97,24 +98,23 @@ actor_system_config::actor_system_config() ...@@ -97,24 +98,23 @@ actor_system_config::actor_system_config()
"frequency of relaxed steal attempts") "frequency of relaxed steal attempts")
.add<timespan>("relaxed-sleep-duration", .add<timespan>("relaxed-sleep-duration",
"sleep duration between relaxed steal attempts"); "sleep duration between relaxed steal attempts");
opt_group{custom_options_, "logger"} opt_group{custom_options_, "caf.logger"} //
.add<std::string>("verbosity", "default verbosity for file and console")
.add<string>("file-name", "filesystem path of the log file")
.add<string>("file-format", "line format for individual log file entries")
.add<std::string>("file-verbosity", "file output verbosity")
.add<std::string>("console",
"std::clog output: none, colored, or uncolored")
.add<string>("console-format", "line format for printed log entries")
.add<std::string>("console-verbosity", "console output verbosity")
.add<std::vector<std::string>>("component-blacklist",
"excluded components for logging")
.add<bool>("inline-output", "disable logger thread (for testing only!)"); .add<bool>("inline-output", "disable logger thread (for testing only!)");
opt_group{custom_options_, "middleman"} opt_group{custom_options_, "caf.logger.file"}
.add<string>("path", "filesystem path for the log file")
.add<string>("format", "format for individual log file entries")
.add<string>("verbosity", "minimum severity level for file output")
.add<string_list>("excluded-components", "excluded components in files");
opt_group{custom_options_, "caf.logger.console"}
.add<bool>("colored", "forces colored or uncolored output")
.add<string>("format", "format for printed console lines")
.add<string>("verbosity", "minimum severity level for console output")
.add<string_list>("excluded-components", "excluded components on console");
opt_group{custom_options_, "caf.middleman"}
.add<std::string>("network-backend", .add<std::string>("network-backend",
"either 'default' or 'asio' (if available)") "either 'default' or 'asio' (if available)")
.add<std::vector<string>>("app-identifiers", .add<std::vector<string>>("app-identifiers",
"valid application identifiers of this node") "valid application identifiers of this node")
.add<string>("app-identifier", "DEPRECATED: use app-identifiers instead")
.add<bool>("enable-automatic-connections", .add<bool>("enable-automatic-connections",
"enables automatic connection management") "enables automatic connection management")
.add<size_t>("max-consecutive-reads", .add<size_t>("max-consecutive-reads",
...@@ -125,7 +125,7 @@ actor_system_config::actor_system_config() ...@@ -125,7 +125,7 @@ actor_system_config::actor_system_config()
.add<bool>("manual-multiplexing", .add<bool>("manual-multiplexing",
"disables background activity of the multiplexer") "disables background activity of the multiplexer")
.add<size_t>("workers", "number of deserialization workers"); .add<size_t>("workers", "number of deserialization workers");
opt_group(custom_options_, "openssl") opt_group(custom_options_, "caf.openssl")
.add<string>(openssl_certificate, "certificate", .add<string>(openssl_certificate, "certificate",
"path to the PEM-formatted certificate file") "path to the PEM-formatted certificate file")
.add<string>(openssl_key, "key", .add<string>(openssl_key, "key",
...@@ -140,8 +140,9 @@ actor_system_config::actor_system_config() ...@@ -140,8 +140,9 @@ actor_system_config::actor_system_config()
settings actor_system_config::dump_content() const { settings actor_system_config::dump_content() const {
settings result = content; settings result = content;
auto& caf_group = result["caf"].as_dictionary();
// -- streaming parameters // -- streaming parameters
auto& stream_group = result["stream"].as_dictionary(); auto& stream_group = caf_group["stream"].as_dictionary();
put_missing(stream_group, "desired-batch-complexity", put_missing(stream_group, "desired-batch-complexity",
defaults::stream::desired_batch_complexity); defaults::stream::desired_batch_complexity);
put_missing(stream_group, "max-batch-delay", put_missing(stream_group, "max-batch-delay",
...@@ -154,7 +155,7 @@ settings actor_system_config::dump_content() const { ...@@ -154,7 +155,7 @@ settings actor_system_config::dump_content() const {
put_missing(stream_group, "size-policy.bytes-per-batch", put_missing(stream_group, "size-policy.bytes-per-batch",
defaults::stream::size_policy::bytes_per_batch); defaults::stream::size_policy::bytes_per_batch);
// -- scheduler parameters // -- scheduler parameters
auto& scheduler_group = result["scheduler"].as_dictionary(); auto& scheduler_group = caf_group["scheduler"].as_dictionary();
put_missing(scheduler_group, "policy", defaults::scheduler::policy); put_missing(scheduler_group, "policy", defaults::scheduler::policy);
put_missing(scheduler_group, "max-throughput", put_missing(scheduler_group, "max-throughput",
defaults::scheduler::max_throughput); defaults::scheduler::max_throughput);
...@@ -163,7 +164,7 @@ settings actor_system_config::dump_content() const { ...@@ -163,7 +164,7 @@ settings actor_system_config::dump_content() const {
defaults::scheduler::profiling_resolution); defaults::scheduler::profiling_resolution);
put_missing(scheduler_group, "profiling-output-file", std::string{}); put_missing(scheduler_group, "profiling-output-file", std::string{});
// -- work-stealing parameters // -- work-stealing parameters
auto& work_stealing_group = result["work-stealing"].as_dictionary(); auto& work_stealing_group = caf_group["work-stealing"].as_dictionary();
put_missing(work_stealing_group, "aggressive-poll-attempts", put_missing(work_stealing_group, "aggressive-poll-attempts",
defaults::work_stealing::aggressive_poll_attempts); defaults::work_stealing::aggressive_poll_attempts);
put_missing(work_stealing_group, "aggressive-steal-interval", put_missing(work_stealing_group, "aggressive-steal-interval",
...@@ -179,18 +180,18 @@ settings actor_system_config::dump_content() const { ...@@ -179,18 +180,18 @@ settings actor_system_config::dump_content() const {
put_missing(work_stealing_group, "relaxed-sleep-duration", put_missing(work_stealing_group, "relaxed-sleep-duration",
defaults::work_stealing::relaxed_sleep_duration); defaults::work_stealing::relaxed_sleep_duration);
// -- logger parameters // -- logger parameters
auto& logger_group = result["logger"].as_dictionary(); auto& logger_group = caf_group["logger"].as_dictionary();
put_missing(logger_group, "file-name", defaults::logger::file_name);
put_missing(logger_group, "file-format", defaults::logger::file_format);
put_missing(logger_group, "file-verbosity", defaults::logger::file_verbosity);
put_missing(logger_group, "console", defaults::logger::console);
put_missing(logger_group, "console-format", defaults::logger::console_format);
put_missing(logger_group, "console-verbosity",
defaults::logger::console_verbosity);
put_missing(logger_group, "component-blacklist", std::vector<std::string>{});
put_missing(logger_group, "inline-output", false); put_missing(logger_group, "inline-output", false);
auto& file_group = logger_group["file"].as_dictionary();
put_missing(file_group, "path", defaults::logger::file::path);
put_missing(file_group, "format", defaults::logger::file::format);
put_missing(file_group, "excluded-components", std::vector<std::string>{});
auto& console_group = logger_group["console"].as_dictionary();
put_missing(console_group, "colored", defaults::logger::console::colored);
put_missing(console_group, "format", defaults::logger::console::format);
put_missing(console_group, "excluded-components", std::vector<std::string>{});
// -- middleman parameters // -- middleman parameters
auto& middleman_group = result["middleman"].as_dictionary(); auto& middleman_group = caf_group["middleman"].as_dictionary();
auto default_id = to_string(defaults::middleman::app_identifier); auto default_id = to_string(defaults::middleman::app_identifier);
put_missing(middleman_group, "app-identifiers", put_missing(middleman_group, "app-identifiers",
std::vector<std::string>{std::move(default_id)}); std::vector<std::string>{std::move(default_id)});
...@@ -200,7 +201,7 @@ settings actor_system_config::dump_content() const { ...@@ -200,7 +201,7 @@ settings actor_system_config::dump_content() const {
put_missing(middleman_group, "heartbeat-interval", put_missing(middleman_group, "heartbeat-interval",
defaults::middleman::heartbeat_interval); defaults::middleman::heartbeat_interval);
// -- openssl parameters // -- openssl parameters
auto& openssl_group = result["openssl"].as_dictionary(); auto& openssl_group = caf_group["openssl"].as_dictionary();
put_missing(openssl_group, "certificate", std::string{}); put_missing(openssl_group, "certificate", std::string{});
put_missing(openssl_group, "key", std::string{}); put_missing(openssl_group, "key", std::string{});
put_missing(openssl_group, "passphrase", std::string{}); put_missing(openssl_group, "passphrase", std::string{});
...@@ -334,7 +335,7 @@ error actor_system_config::parse(string_list args, std::istream& config) { ...@@ -334,7 +335,7 @@ error actor_system_config::parse(string_list args, std::istream& config) {
std::cout << std::flush; std::cout << std::flush;
cli_helptext_printed = true; cli_helptext_printed = true;
} }
return adjust_content(); return none;
} }
error actor_system_config::parse(string_list args, error actor_system_config::parse(string_list args,
...@@ -361,11 +362,6 @@ actor_system_config& actor_system_config::add_actor_factory(std::string name, ...@@ -361,11 +362,6 @@ actor_system_config& actor_system_config::add_actor_factory(std::string name,
actor_system_config& actor_system_config::set_impl(string_view name, actor_system_config& actor_system_config::set_impl(string_view name,
config_value value) { config_value value) {
if (name == "middleman.app-identifier") {
// TODO: Print a warning with 0.18 and remove this code with 0.19.
value.convert_to_list();
return set_impl("middleman.app-identifiers", std::move(value));
}
auto opt = custom_options_.qualified_name_lookup(name); auto opt = custom_options_.qualified_name_lookup(name);
if (opt == nullptr) { if (opt == nullptr) {
std::cerr << "*** failed to set config parameter " << name std::cerr << "*** failed to set config parameter " << name
...@@ -376,9 +372,10 @@ actor_system_config& actor_system_config::set_impl(string_view name, ...@@ -376,9 +372,10 @@ actor_system_config& actor_system_config::set_impl(string_view name,
} else { } else {
opt->store(value); opt->store(value);
auto category = opt->category(); auto category = opt->category();
auto& dict = category == "global" ? content if (category == "global")
: content[category].as_dictionary(); content[opt->long_name()] = std::move(value);
dict[opt->long_name()] = std::move(value); else
put(content, name, std::move(value));
} }
return *this; return *this;
} }
...@@ -455,25 +452,6 @@ error actor_system_config::extract_config_file_path(string_list& args) { ...@@ -455,25 +452,6 @@ error actor_system_config::extract_config_file_path(string_list& args) {
return none; return none;
} }
error actor_system_config::adjust_content() {
// TODO: Print a warning to STDERR if 'app-identifier' is present with 0.18
// and remove this code with 0.19.
auto i = content.find("middleman");
if (i != content.end()) {
if (auto mm = get_if<settings>(&i->second)) {
auto j = mm->find("app-identifier");
if (j != mm->end()) {
if (!mm->contains("app-identifiers")) {
j->second.convert_to_list();
mm->emplace("app-identifiers", std::move(j->second));
}
mm->container().erase(j);
}
}
}
return none;
}
const settings& content(const actor_system_config& cfg) { const settings& content(const actor_system_config& cfg) {
return cfg.content; return cfg.content;
} }
......
...@@ -236,9 +236,7 @@ config_option_set::parse(settings& config, ...@@ -236,9 +236,7 @@ config_option_set::parse(settings& config,
} }
config_option_set::option_pointer config_option_set::option_pointer
config_option_set::cli_long_name_lookup(string_view input) const { config_option_set::cli_long_name_lookup(string_view name) const {
// We accept "caf#" prefixes for backward compatibility, but ignore them.
auto name = input.substr(input.compare(0, 4, "caf#") != 0 ? 0u : 4u);
// Extract category and long name. // Extract category and long name.
string_view category; string_view category;
string_view long_name; string_view long_name;
......
...@@ -55,7 +55,7 @@ void await_all_locals_down(actor_system& sys, std::initializer_list<actor> xs) { ...@@ -55,7 +55,7 @@ void await_all_locals_down(actor_system& sys, std::initializer_list<actor> xs) {
ys.push_back(x); ys.push_back(x);
} }
// Don't block when using the test coordinator. // Don't block when using the test coordinator.
if (auto policy = get_if<std::string>(&sys.config(), "scheduler.policy"); if (auto policy = get_if<std::string>(&sys.config(), "caf.scheduler.policy");
policy && *policy != "testing") policy && *policy != "testing")
self->wait_for(ys); self->wait_for(ys);
} }
......
...@@ -78,7 +78,7 @@ inbound_path::inbound_path(stream_manager_ptr mgr_ptr, stream_slots id, ...@@ -78,7 +78,7 @@ inbound_path::inbound_path(stream_manager_ptr mgr_ptr, stream_slots id,
<< detail::global_meta_object(in_type)->type_name << detail::global_meta_object(in_type)->type_name
<< "at slot" << id.receiver << "from" << hdl); << "at slot" << id.receiver << "from" << hdl);
if (auto str = get_if<std::string>(&self()->system().config(), if (auto str = get_if<std::string>(&self()->system().config(),
"stream.credit-policy")) { "caf.stream.credit-policy")) {
if (*str == "testing") if (*str == "testing")
controller_.reset(new detail::test_credit_controller(self())); controller_.reset(new detail::test_credit_controller(self()));
else if (*str == "size") else if (*str == "size")
......
...@@ -283,7 +283,7 @@ logger* logger::current_logger() { ...@@ -283,7 +283,7 @@ logger* logger::current_logger() {
bool logger::accepts(unsigned level, string_view cname) { bool logger::accepts(unsigned level, string_view cname) {
if (level > cfg_.verbosity) if (level > cfg_.verbosity)
return false; return false;
return !std::any_of(component_blacklist.begin(), component_blacklist.end(), return std::none_of(global_filter_.begin(), global_filter_.end(),
[=](string_view name) { return name == cname; }); [=](string_view name) { return name == cname; });
} }
...@@ -302,51 +302,48 @@ logger::~logger() { ...@@ -302,51 +302,48 @@ logger::~logger() {
void logger::init(actor_system_config& cfg) { void logger::init(actor_system_config& cfg) {
CAF_IGNORE_UNUSED(cfg); CAF_IGNORE_UNUSED(cfg);
namespace lg = defaults::logger; namespace lg = defaults::logger;
using std::string;
using string_list = std::vector<std::string>; using string_list = std::vector<std::string>;
auto blacklist = get_if<string_list>(&cfg, "logger.component-blacklist"); auto get_verbosity = [&cfg](string_view key) -> unsigned {
if (blacklist) if (auto str = get_if<string>(&cfg, key))
component_blacklist = move_if_optional(blacklist); return to_level_int(*str);
// Parse the configured log level. We only store a string_view to the return CAF_LOG_LEVEL_QUIET;
// verbosity levels, so we make sure we actually get a string pointer here
// (and not an optional<string>).
const std::string* verbosity = get_if<std::string>(&cfg, "logger.verbosity");
auto set_level = [&](auto& var, auto var_default, string_view var_key) {
// User-provided overrides have the highest priority.
if (const std::string* var_override = get_if<std::string>(&cfg, var_key)) {
var = *var_override;
return;
}
// If present, "logger.verbosity" overrides the defaults for both file and
// console verbosity level.
if (verbosity) {
var = *verbosity;
return;
}
var = var_default;
}; };
string_view file_str; auto read_filter = [&cfg](string_list& var, string_view key) {
string_view console_str; if (auto lst = get_if<string_list>(&cfg, key))
set_level(file_str, lg::file_verbosity, "logger.file-verbosity"); var = std::move(*lst);
set_level(console_str, lg::console_verbosity, "logger.console-verbosity"); };
cfg_.file_verbosity = to_level_int(file_str); cfg_.file_verbosity = get_verbosity("caf.logger.file.verbosity");
cfg_.console_verbosity = to_level_int(console_str); cfg_.console_verbosity = get_verbosity("caf.logger.console.verbosity");
cfg_.verbosity = std::max(cfg_.file_verbosity, cfg_.console_verbosity); cfg_.verbosity = std::max(cfg_.file_verbosity, cfg_.console_verbosity);
if (cfg_.verbosity == CAF_LOG_LEVEL_QUIET)
return;
if (cfg_.file_verbosity > CAF_LOG_LEVEL_QUIET
&& cfg_.console_verbosity > CAF_LOG_LEVEL_QUIET) {
read_filter(file_filter_, "caf.logger.file.excluded-components");
read_filter(console_filter_, "caf.logger.console.excluded-components");
std::sort(file_filter_.begin(), file_filter_.end());
std::sort(console_filter_.begin(), console_filter_.end());
std::set_union(file_filter_.begin(), file_filter_.end(),
console_filter_.begin(), console_filter_.end(),
std::back_inserter(global_filter_));
} else if (cfg_.file_verbosity > CAF_LOG_LEVEL_QUIET) {
read_filter(file_filter_, "caf.logger.file.excluded-components");
global_filter_ = file_filter_;
} else {
read_filter(console_filter_, "caf.logger.console.excluded-components");
global_filter_ = console_filter_;
}
// Parse the format string. // Parse the format string.
file_format_ = file_format_
parse_format(get_or(cfg, "logger.file-format", lg::file_format)); = parse_format(get_or(cfg, "caf.logger.file.format", lg::file::format));
console_format_ = parse_format(get_or(cfg,"logger.console-format", console_format_ = parse_format(
lg::console_format)); get_or(cfg, "caf.logger.console.format", lg::console::format));
// Set flags. // Set flags.
if (get_or(cfg, "logger.inline-output", false)) if (get_or(cfg, "caf.logger.inline-output", false))
cfg_.inline_output = true; cfg_.inline_output = true;
auto con = get_or(cfg, "logger.console", lg::console); // If not set to `false`, CAF enables colored output when writing to TTYs.
if (con == "colored") { cfg_.console_coloring = get_or(cfg, "caf.logger.console.colored", true);
cfg_.console_coloring = true;
} else if (con != "uncolored") {
// Disable console output if neither 'colored' nor 'uncolored' are present.
cfg_.console_verbosity = CAF_LOG_LEVEL_QUIET;
cfg_.verbosity = cfg_.file_verbosity;
}
} }
bool logger::open_file() { bool logger::open_file() {
...@@ -572,21 +569,20 @@ void logger::handle_event(const event& x) { ...@@ -572,21 +569,20 @@ void logger::handle_event(const event& x) {
void logger::log_first_line() { void logger::log_first_line() {
auto e = CAF_LOG_MAKE_EVENT(0, CAF_LOG_COMPONENT, CAF_LOG_LEVEL_DEBUG, ""); auto e = CAF_LOG_MAKE_EVENT(0, CAF_LOG_COMPONENT, CAF_LOG_LEVEL_DEBUG, "");
auto make_message = [&](string_view config_name, std::string default_value) { auto make_message = [&](int level, const auto& filter) {
std::string msg = "level = "; auto lvl_str = log_level_name[level];
msg += get_or(system_.config(), config_name, default_value); std::string msg = "verbosity = ";
msg.insert(msg.end(), lvl_str.begin(), lvl_str.end());
msg += ", node = "; msg += ", node = ";
msg += to_string(system_.node()); msg += to_string(system_.node());
msg += ", component-blacklist = "; msg += ", excluded-components = ";
msg += deep_to_string(component_blacklist); msg += deep_to_string(filter);
return msg; return msg;
}; };
namespace lg = defaults::logger; namespace lg = defaults::logger;
e.message = make_message("logger.file-verbosity", e.message = make_message(cfg_.file_verbosity, file_filter_);
to_string(lg::file_verbosity));
handle_file_event(e); handle_file_event(e);
e.message = make_message("logger.console-verbosity", e.message = make_message(cfg_.console_verbosity, console_filter_);
to_string(lg::console_verbosity));
handle_console_event(e); handle_console_event(e);
} }
...@@ -599,8 +595,8 @@ void logger::start() { ...@@ -599,8 +595,8 @@ void logger::start() {
parent_thread_ = std::this_thread::get_id(); parent_thread_ = std::this_thread::get_id();
if (verbosity() == CAF_LOG_LEVEL_QUIET) if (verbosity() == CAF_LOG_LEVEL_QUIET)
return; return;
file_name_ = get_or(system_.config(), "logger.file-name", file_name_ = get_or(system_.config(), "caf.logger.file.path",
defaults::logger::file_name); defaults::logger::file::path);
if (file_name_.empty()) { if (file_name_.empty()) {
// No need to continue if console and log file are disabled. // No need to continue if console and log file are disabled.
if (console_verbosity() == CAF_LOG_LEVEL_QUIET) if (console_verbosity() == CAF_LOG_LEVEL_QUIET)
......
...@@ -247,8 +247,9 @@ void abstract_coordinator::start() { ...@@ -247,8 +247,9 @@ void abstract_coordinator::start() {
void abstract_coordinator::init(actor_system_config& cfg) { void abstract_coordinator::init(actor_system_config& cfg) {
namespace sr = defaults::scheduler; namespace sr = defaults::scheduler;
max_throughput_ = get_or(cfg, "scheduler.max-throughput", sr::max_throughput); max_throughput_ = get_or(cfg, "caf.scheduler.max-throughput",
if (auto num_workers = get_if<size_t>(&cfg, "scheduler.max-threads")) sr::max_throughput);
if (auto num_workers = get_if<size_t>(&cfg, "caf.scheduler.max-threads"))
num_workers_ = *num_workers; num_workers_ = *num_workers;
else else
num_workers_ = default_thread_count(); num_workers_ = default_thread_count();
......
...@@ -109,7 +109,7 @@ behavior tester(event_based_actor* self, const actor& aut) { ...@@ -109,7 +109,7 @@ behavior tester(event_based_actor* self, const actor& aut) {
struct config : actor_system_config { struct config : actor_system_config {
config() { config() {
set("scheduler.policy", "testing"); set("caf.scheduler.policy", "testing");
} }
}; };
......
...@@ -61,7 +61,9 @@ namespace { ...@@ -61,7 +61,9 @@ namespace {
struct fixture { struct fixture {
fixture() { fixture() {
cfg.set("scheduler.policy", "testing"); cfg.set("caf.scheduler.policy", "testing");
cfg.set("caf.logger.file.verbosity", "debug");
cfg.set("caf.logger.file.path", "");
} }
void add(logger::field_type kind) { void add(logger::field_type kind) {
...@@ -161,10 +163,7 @@ CAF_TEST(parse_default_format_strings) { ...@@ -161,10 +163,7 @@ CAF_TEST(parse_default_format_strings) {
add(logger::message_field); add(logger::message_field);
add(logger::newline_field); add(logger::newline_field);
CAF_CHECK_EQUAL(logger::parse_format(file_format), lf); CAF_CHECK_EQUAL(logger::parse_format(file_format), lf);
#if CAF_LOG_LEVEL >= 0
// Not parsed when compiling without logging enabled.
CAF_CHECK_EQUAL(sys.logger().file_format(), lf); CAF_CHECK_EQUAL(sys.logger().file_format(), lf);
#endif
} }
CAF_TEST(rendering) { CAF_TEST(rendering) {
......
...@@ -530,7 +530,7 @@ struct fixture { ...@@ -530,7 +530,7 @@ struct fixture {
if (auto err = cfg.parse(caf::test::engine::argc(), if (auto err = cfg.parse(caf::test::engine::argc(),
caf::test::engine::argv())) caf::test::engine::argv()))
CAF_FAIL("parsing the config failed: " << to_string(err)); CAF_FAIL("parsing the config failed: " << to_string(err));
cfg.set("scheduler.policy", "testing"); cfg.set("caf.scheduler.policy", "testing");
return cfg; return cfg;
} }
......
...@@ -116,7 +116,7 @@ CAF_TEST_FIXTURE_SCOPE(counting_hook, fixture<counting_thread_hook>) ...@@ -116,7 +116,7 @@ CAF_TEST_FIXTURE_SCOPE(counting_hook, fixture<counting_thread_hook>)
CAF_TEST(counting_system_without_actor) { CAF_TEST(counting_system_without_actor) {
assumed_init_calls = 1; assumed_init_calls = 1;
auto fallback = scheduler::abstract_coordinator::default_thread_count(); auto fallback = scheduler::abstract_coordinator::default_thread_count();
assumed_thread_count = get_or(cfg, "scheduler.max-threads", fallback) assumed_thread_count = get_or(cfg, "caf.scheduler.max-threads", fallback)
+ 1; // caf.clock + 1; // caf.clock
auto& sched = sys.scheduler(); auto& sched = sys.scheduler();
if (sched.detaches_utility_actors()) if (sched.detaches_utility_actors())
...@@ -126,7 +126,7 @@ CAF_TEST(counting_system_without_actor) { ...@@ -126,7 +126,7 @@ CAF_TEST(counting_system_without_actor) {
CAF_TEST(counting_system_with_actor) { CAF_TEST(counting_system_with_actor) {
assumed_init_calls = 1; assumed_init_calls = 1;
auto fallback = scheduler::abstract_coordinator::default_thread_count(); auto fallback = scheduler::abstract_coordinator::default_thread_count();
assumed_thread_count = get_or(cfg, "scheduler.max-threads", fallback) assumed_thread_count = get_or(cfg, "caf.scheduler.max-threads", fallback)
+ 2; // caf.clock and detached actor + 2; // caf.clock and detached actor
auto& sched = sys.scheduler(); auto& sched = sys.scheduler();
if (sched.detaches_utility_actors()) if (sched.detaches_utility_actors())
......
...@@ -44,7 +44,7 @@ instance::instance(abstract_broker* parent, callee& lstnr) ...@@ -44,7 +44,7 @@ instance::instance(abstract_broker* parent, callee& lstnr)
: tbl_(parent), this_node_(parent->system().node()), callee_(lstnr) { : tbl_(parent), this_node_(parent->system().node()), callee_(lstnr) {
CAF_ASSERT(this_node_ != none); CAF_ASSERT(this_node_ != none);
size_t workers; size_t workers;
if (auto workers_cfg = get_if<size_t>(&config(), "middleman.workers")) if (auto workers_cfg = get_if<size_t>(&config(), "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;
...@@ -231,7 +231,8 @@ void instance::write_server_handshake(execution_unit* ctx, byte_buffer& out_buf, ...@@ -231,7 +231,8 @@ void instance::write_server_handshake(execution_unit* ctx, byte_buffer& out_buf,
auto writer = make_callback([&](binary_serializer& sink) { auto writer = make_callback([&](binary_serializer& sink) {
using string_list = std::vector<std::string>; using string_list = std::vector<std::string>;
string_list app_ids; string_list app_ids;
if (auto ids = get_if<string_list>(&config(), "middleman.app-identifiers")) if (auto ids = get_if<string_list>(&config(),
"caf.middleman.app-identifiers"))
app_ids = std::move(*ids); app_ids = std::move(*ids);
else else
app_ids.emplace_back(to_string(defaults::middleman::app_identifier)); app_ids.emplace_back(to_string(defaults::middleman::app_identifier));
...@@ -323,7 +324,8 @@ connection_state instance::handle(execution_unit* ctx, connection_handle hdl, ...@@ -323,7 +324,8 @@ connection_state instance::handle(execution_unit* ctx, connection_handle hdl,
} }
// Check the application ID. // Check the application ID.
string_list whitelist; string_list whitelist;
if (auto ls = get_if<string_list>(&config(), "middleman.app-identifiers")) if (auto ls = get_if<string_list>(&config(),
"caf.middleman.app-identifiers"))
whitelist = std::move(*ls); whitelist = std::move(*ls);
else else
whitelist.emplace_back(to_string(defaults::middleman::app_identifier)); whitelist.emplace_back(to_string(defaults::middleman::app_identifier));
......
...@@ -105,7 +105,7 @@ behavior basp_broker::make_behavior() { ...@@ -105,7 +105,7 @@ behavior basp_broker::make_behavior() {
set_down_handler([](local_actor* ptr, down_msg& x) { set_down_handler([](local_actor* ptr, down_msg& x) {
static_cast<basp_broker*>(ptr)->handle_down_msg(x); static_cast<basp_broker*>(ptr)->handle_down_msg(x);
}); });
if (get_or(config(), "middleman.enable-automatic-connections", false)) { if (get_or(config(), "caf.middleman.enable-automatic-connections", false)) {
CAF_LOG_DEBUG("enable automatic connections"); CAF_LOG_DEBUG("enable automatic connections");
// open a random port and store a record for our peers how to // open a random port and store a record for our peers how to
// connect to this broker directly in the configuration server // connect to this broker directly in the configuration server
...@@ -120,7 +120,7 @@ behavior basp_broker::make_behavior() { ...@@ -120,7 +120,7 @@ behavior basp_broker::make_behavior() {
} }
automatic_connections = true; automatic_connections = true;
} }
auto heartbeat_interval = get_or(config(), "middleman.heartbeat-interval", auto heartbeat_interval = get_or(config(), "caf.middleman.heartbeat-interval",
defaults::middleman::heartbeat_interval); defaults::middleman::heartbeat_interval);
if (heartbeat_interval > 0) { if (heartbeat_interval > 0) {
CAF_LOG_DEBUG("enable heartbeat" << CAF_ARG(heartbeat_interval)); CAF_LOG_DEBUG("enable heartbeat" << CAF_ARG(heartbeat_interval));
...@@ -585,7 +585,7 @@ void basp_broker::learned_new_node_indirectly(const node_id& nid) { ...@@ -585,7 +585,7 @@ void basp_broker::learned_new_node_indirectly(const node_id& nid) {
// connection to the routing table; hence, spawning our helper here exactly // connection to the routing table; hence, spawning our helper here exactly
// once and there is no need to track in-flight connection requests. // once and there is no need to track in-flight connection requests.
using namespace detail; using namespace detail;
auto tmp = get_or(config(), "middleman.attach-utility-actors", false) auto tmp = get_or(config(), "caf.middleman.attach-utility-actors", false)
? system().spawn<hidden>(connection_helper, this) ? system().spawn<hidden>(connection_helper, this)
: system().spawn<detached + hidden>(connection_helper, this); : system().spawn<detached + hidden>(connection_helper, this);
auto sender = actor_cast<strong_actor_ptr>(tmp); auto sender = actor_cast<strong_actor_ptr>(tmp);
......
...@@ -87,7 +87,7 @@ void middleman::init_global_meta_objects() { ...@@ -87,7 +87,7 @@ void middleman::init_global_meta_objects() {
} }
actor_system::module* middleman::make(actor_system& sys, detail::type_list<>) { actor_system::module* middleman::make(actor_system& sys, detail::type_list<>) {
auto impl = get_or(sys.config(), "middleman.network-backend", auto impl = get_or(sys.config(), "caf.middleman.network-backend",
defaults::middleman::network_backend); defaults::middleman::network_backend);
if (impl == "testing") if (impl == "testing")
return new mm_impl<network::test_multiplexer>(sys); return new mm_impl<network::test_multiplexer>(sys);
...@@ -272,7 +272,7 @@ strong_actor_ptr middleman::remote_lookup(std::string name, ...@@ -272,7 +272,7 @@ strong_actor_ptr middleman::remote_lookup(std::string name,
void middleman::start() { void middleman::start() {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
// Launch backend. // Launch backend.
if (!get_or(config(), "middleman.manual-multiplexing", false)) if (!get_or(config(), "caf.middleman.manual-multiplexing", false))
backend_supervisor_ = backend().make_supervisor(); backend_supervisor_ = backend().make_supervisor();
// The only backend that returns a `nullptr` by default is the // The only backend that returns a `nullptr` by default is the
// `test_multiplexer` which does not have its own thread but uses the main // `test_multiplexer` which does not have its own thread but uses the main
...@@ -332,7 +332,7 @@ void middleman::stop() { ...@@ -332,7 +332,7 @@ void middleman::stop() {
} }
} }
}); });
if (!get_or(config(), "middleman.manual-multiplexing", false)) { if (!get_or(config(), "caf.middleman.manual-multiplexing", false)) {
backend_supervisor_.reset(); backend_supervisor_.reset();
if (thread_.joinable()) if (thread_.joinable())
thread_.join(); thread_.join();
...@@ -343,7 +343,7 @@ void middleman::stop() { ...@@ -343,7 +343,7 @@ void middleman::stop() {
named_brokers_.clear(); named_brokers_.clear();
scoped_actor self{system(), true}; scoped_actor self{system(), true};
self->send_exit(manager_, exit_reason::kill); self->send_exit(manager_, exit_reason::kill);
if (!get_or(config(), "middleman.attach-utility-actors", false)) if (!get_or(config(), "caf.middleman.attach-utility-actors", false))
self->wait_for(manager_); self->wait_for(manager_);
destroy(manager_); destroy(manager_);
} }
...@@ -351,11 +351,11 @@ void middleman::stop() { ...@@ -351,11 +351,11 @@ void middleman::stop() {
void middleman::init(actor_system_config& cfg) { void middleman::init(actor_system_config& cfg) {
// Note: logging is not available at this stage. // Note: logging is not available at this stage.
// Never detach actors when using the testing multiplexer. // Never detach actors when using the testing multiplexer.
auto network_backend = get_or(cfg, "middleman.network-backend", auto network_backend = get_or(cfg, "caf.middleman.network-backend",
defaults::middleman::network_backend); defaults::middleman::network_backend);
if (network_backend == "testing") { if (network_backend == "testing") {
cfg.set("middleman.attach-utility-actors", true) cfg.set("caf.middleman.attach-utility-actors", true)
.set("middleman.manual-multiplexing", true); .set("caf.middleman.manual-multiplexing", true);
} }
// Add remote group module to config. // Add remote group module to config.
struct remote_groups : group_module { struct remote_groups : group_module {
......
...@@ -31,7 +31,7 @@ ...@@ -31,7 +31,7 @@
namespace caf::io { namespace caf::io {
middleman_actor make_middleman_actor(actor_system& sys, actor db) { middleman_actor make_middleman_actor(actor_system& sys, actor db) {
return get_or(sys.config(), "middleman.attach-utility-actors", false) return get_or(sys.config(), "caf.middleman.attach-utility-actors", false)
? sys.spawn<middleman_actor_impl, hidden>(std::move(db)) ? sys.spawn<middleman_actor_impl, hidden>(std::move(db))
: sys.spawn<middleman_actor_impl, detached + hidden>(std::move(db)); : sys.spawn<middleman_actor_impl, detached + hidden>(std::move(db));
} }
......
...@@ -39,7 +39,7 @@ datagram_handler::datagram_handler(default_multiplexer& backend_ref, ...@@ -39,7 +39,7 @@ datagram_handler::datagram_handler(default_multiplexer& backend_ref,
native_socket sockfd) native_socket sockfd)
: event_handler(backend_ref, sockfd), : event_handler(backend_ref, sockfd),
max_consecutive_reads_(get_or(backend().system().config(), max_consecutive_reads_(get_or(backend().system().config(),
"middleman.max-consecutive-reads", "caf.middleman.max-consecutive-reads",
defaults::middleman::max_consecutive_reads)), defaults::middleman::max_consecutive_reads)),
max_datagram_size_(receive_buffer_size), max_datagram_size_(receive_buffer_size),
rd_buf_(receive_buffer_size), rd_buf_(receive_buffer_size),
......
...@@ -589,8 +589,8 @@ void default_multiplexer::init() { ...@@ -589,8 +589,8 @@ void default_multiplexer::init() {
} }
#endif #endif
namespace sr = defaults::scheduler; namespace sr = defaults::scheduler;
max_throughput_ max_throughput_ = get_or(system().config(), "caf.scheduler.max-throughput",
= get_or(system().config(), "scheduler.max-throughput", sr::max_throughput); sr::max_throughput);
} }
bool default_multiplexer::poll_once(bool block) { bool default_multiplexer::poll_once(bool block) {
......
...@@ -31,7 +31,7 @@ namespace caf::io::network { ...@@ -31,7 +31,7 @@ namespace caf::io::network {
stream::stream(default_multiplexer& backend_ref, native_socket sockfd) stream::stream(default_multiplexer& backend_ref, native_socket sockfd)
: event_handler(backend_ref, sockfd), : event_handler(backend_ref, sockfd),
max_consecutive_reads_(get_or(backend().system().config(), max_consecutive_reads_(get_or(backend().system().config(),
"middleman.max-consecutive-reads", "caf.middleman.max-consecutive-reads",
defaults::middleman::max_consecutive_reads)), defaults::middleman::max_consecutive_reads)),
read_threshold_(1), read_threshold_(1),
collected_(0), collected_(0),
......
...@@ -105,10 +105,10 @@ class fixture { ...@@ -105,10 +105,10 @@ class fixture {
public: public:
fixture(bool autoconn = false) fixture(bool autoconn = false)
: sys(cfg.load<io::middleman, network::test_multiplexer>() : sys(cfg.load<io::middleman, network::test_multiplexer>()
.set("middleman.enable-automatic-connections", autoconn) .set("caf.middleman.enable-automatic-connections", autoconn)
.set("middleman.workers", size_t{0}) .set("caf.middleman.workers", size_t{0})
.set("scheduler.policy", autoconn ? "testing" : "stealing") .set("caf.scheduler.policy", autoconn ? "testing" : "stealing")
.set("middleman.attach-utility-actors", autoconn)) { .set("caf.middleman.attach-utility-actors", autoconn)) {
app_ids.emplace_back(to_string(defaults::middleman::app_identifier)); app_ids.emplace_back(to_string(defaults::middleman::app_identifier));
auto& mm = sys.middleman(); auto& mm = sys.middleman();
mpx_ = dynamic_cast<network::test_multiplexer*>(&mm.backend()); mpx_ = dynamic_cast<network::test_multiplexer*>(&mm.backend());
......
...@@ -104,7 +104,7 @@ void manager::stop() { ...@@ -104,7 +104,7 @@ void manager::stop() {
CAF_LOG_TRACE(""); CAF_LOG_TRACE("");
scoped_actor self{system(), true}; scoped_actor self{system(), true};
self->send_exit(manager_, exit_reason::kill); self->send_exit(manager_, exit_reason::kill);
if (!get_or(config(), "middleman.attach-utility-actors", false)) if (!get_or(config(), "caf.middleman.attach-utility-actors", false))
self->wait_for(manager_); self->wait_for(manager_);
manager_ = nullptr; manager_ = nullptr;
} }
......
...@@ -284,7 +284,7 @@ private: ...@@ -284,7 +284,7 @@ private:
} // namespace } // namespace
io::middleman_actor make_middleman_actor(actor_system& sys, actor db) { io::middleman_actor make_middleman_actor(actor_system& sys, actor db) {
return !get_or(sys.config(), "middleman.attach-utility-actors", false) return !get_or(sys.config(), "caf.middleman.attach-utility-actors", false)
? sys.spawn<middleman_actor_impl, detached + hidden>(std::move(db)) ? sys.spawn<middleman_actor_impl, detached + hidden>(std::move(db))
: sys.spawn<middleman_actor_impl, hidden>(std::move(db)); : sys.spawn<middleman_actor_impl, hidden>(std::move(db));
} }
......
...@@ -54,9 +54,9 @@ public: ...@@ -54,9 +54,9 @@ public:
config() { config() {
load<io::middleman>(); load<io::middleman>();
load<openssl::manager>(); load<openssl::manager>();
set("middleman.manual-multiplexing", true); set("caf.middleman.manual-multiplexing", true);
set("middleman.attach-utility-actors", true); set("caf.middleman.attach-utility-actors", true);
set("scheduler.policy", "testing"); set("caf.scheduler.policy", "testing");
} }
static std::string data_dir() { static std::string data_dir() {
......
...@@ -45,7 +45,7 @@ public: ...@@ -45,7 +45,7 @@ public:
// OpenSSL to buffer data internally and report "pending" data after a read // OpenSSL to buffer data internally and report "pending" data after a read
// operation. This will trigger `must_read_more` in the SSL read policy // operation. This will trigger `must_read_more` in the SSL read policy
// with high probability. // with high probability.
set("middleman.max-consecutive-reads", 1); set("caf.middleman.max-consecutive-reads", 1);
} }
}; };
......
...@@ -674,16 +674,15 @@ public: ...@@ -674,16 +674,15 @@ public:
// -- constructors, destructors, and assignment operators -------------------- // -- constructors, destructors, and assignment operators --------------------
static Config& init_config(Config& cfg) { static Config& init_config(Config& cfg) {
cfg.set("logger.file-verbosity", "quiet");
if (auto err = cfg.parse(caf::test::engine::argc(), if (auto err = cfg.parse(caf::test::engine::argc(),
caf::test::engine::argv())) caf::test::engine::argv()))
CAF_FAIL("failed to parse config: " << to_string(err)); CAF_FAIL("failed to parse config: " << to_string(err));
cfg.set("scheduler.policy", "testing"); cfg.set("caf.scheduler.policy", "testing");
cfg.set("logger.inline-output", true); cfg.set("caf.logger.inline-output", true);
cfg.set("middleman.network-backend", "testing"); cfg.set("caf.middleman.network-backend", "testing");
cfg.set("middleman.manual-multiplexing", true); cfg.set("caf.middleman.manual-multiplexing", true);
cfg.set("middleman.workers", size_t{0}); cfg.set("caf.middleman.workers", size_t{0});
cfg.set("stream.credit-policy", "testing"); cfg.set("caf.stream.credit-policy", "testing");
return cfg; return cfg;
} }
......
...@@ -176,10 +176,10 @@ void bootstrap(actor_system& system, const string& wdir, ...@@ -176,10 +176,10 @@ void bootstrap(actor_system& system, const string& wdir,
std::ostringstream oss; std::ostringstream oss;
oss << cmd; oss << cmd;
if (slave.cpu_slots > 0) if (slave.cpu_slots > 0)
oss << " --caf#scheduler.max-threads=" << slave.cpu_slots; oss << " --caf.scheduler.max-threads=" << slave.cpu_slots;
oss << " --caf#slave-mode" oss << " --caf.slave-mode"
<< " --caf#slave-name=" << slave.host << " --caf.slave-name=" << slave.host
<< " --caf#bootstrap-node="; << " --caf.bootstrap-node=";
bool is_first = true; bool is_first = true;
interfaces::traverse({protocol::ipv4, protocol::ipv6}, interfaces::traverse({protocol::ipv4, protocol::ipv6},
[&](const char*, protocol::network, [&](const char*, protocol::network,
...@@ -216,7 +216,7 @@ void bootstrap(actor_system& system, const string& wdir, ...@@ -216,7 +216,7 @@ void bootstrap(actor_system& system, const string& wdir,
} }
// run (and wait for) master // run (and wait for) master
std::ostringstream oss; std::ostringstream oss;
oss << cmd << " --caf#slave-nodes=" << slaveslist << " " << join(args, " "); oss << cmd << " --caf.slave-nodes=" << slaveslist << " " << join(args, " ");
run_ssh(system, wdir, oss.str(), master.host); run_ssh(system, wdir, oss.str(), master.host);
} }
......
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