Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
Actor Framework
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cpp-libs
Actor Framework
Commits
2131e2cb
Commit
2131e2cb
authored
Jul 07, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Drop legacy .ini support, scope config parameters
parent
1d4dcede
Changes
29
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
246 additions
and
285 deletions
+246
-285
examples/caf-application.conf
examples/caf-application.conf
+82
-83
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+0
-4
libcaf_core/caf/defaults.hpp
libcaf_core/caf/defaults.hpp
+13
-27
libcaf_core/caf/logger.hpp
libcaf_core/caf/logger.hpp
+9
-2
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+1
-1
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+40
-62
libcaf_core/src/config_option_set.cpp
libcaf_core/src/config_option_set.cpp
+1
-3
libcaf_core/src/group_manager.cpp
libcaf_core/src/group_manager.cpp
+1
-1
libcaf_core/src/inbound_path.cpp
libcaf_core/src/inbound_path.cpp
+1
-1
libcaf_core/src/logger.cpp
libcaf_core/src/logger.cpp
+47
-51
libcaf_core/src/scheduler/abstract_coordinator.cpp
libcaf_core/src/scheduler/abstract_coordinator.cpp
+3
-2
libcaf_core/test/actor_lifetime.cpp
libcaf_core/test/actor_lifetime.cpp
+1
-1
libcaf_core/test/logger.cpp
libcaf_core/test/logger.cpp
+3
-4
libcaf_core/test/native_streaming_classes.cpp
libcaf_core/test/native_streaming_classes.cpp
+1
-1
libcaf_core/test/thread_hook.cpp
libcaf_core/test/thread_hook.cpp
+2
-2
libcaf_io/src/io/basp/instance.cpp
libcaf_io/src/io/basp/instance.cpp
+5
-3
libcaf_io/src/io/basp_broker.cpp
libcaf_io/src/io/basp_broker.cpp
+3
-3
libcaf_io/src/io/middleman.cpp
libcaf_io/src/io/middleman.cpp
+7
-7
libcaf_io/src/io/middleman_actor.cpp
libcaf_io/src/io/middleman_actor.cpp
+1
-1
libcaf_io/src/io/network/datagram_handler.cpp
libcaf_io/src/io/network/datagram_handler.cpp
+1
-1
libcaf_io/src/io/network/default_multiplexer.cpp
libcaf_io/src/io/network/default_multiplexer.cpp
+2
-2
libcaf_io/src/io/network/stream.cpp
libcaf_io/src/io/network/stream.cpp
+1
-1
libcaf_io/test/io/basp_broker.cpp
libcaf_io/test/io/basp_broker.cpp
+4
-4
libcaf_openssl/src/openssl/manager.cpp
libcaf_openssl/src/openssl/manager.cpp
+1
-1
libcaf_openssl/src/openssl/middleman_actor.cpp
libcaf_openssl/src/openssl/middleman_actor.cpp
+1
-1
libcaf_openssl/test/openssl/authentication.cpp
libcaf_openssl/test/openssl/authentication.cpp
+3
-3
libcaf_openssl/test/openssl/remote_actor.cpp
libcaf_openssl/test/openssl/remote_actor.cpp
+1
-1
libcaf_test/caf/test/dsl.hpp
libcaf_test/caf/test/dsl.hpp
+6
-7
tools/caf-run.cpp
tools/caf-run.cpp
+5
-5
No files found.
examples/caf-application.conf
View file @
2131e2cb
# 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
# example, "scheduler.max-threads" has no hard-coded default and instead adjusts
# to the number of cores available.
# when using the default scheduler
scheduler
{
# accepted alternative: "sharing"
policy
=
"stealing"
# configures whether the scheduler generates profiling output
enable
-
profiling
=
false
# forces a fixed number of threads if set
# max-threads=... (detected at runtime)
# maximum number of messages actors can consume in one run (int64 max)
max
-
throughput
=
9223372036854775807
# measurement resolution in milliseconds (only if profiling is enabled)
profiling
-
resolution
=
100
ms
# output file for profiler data (only if profiling is enabled)
profiling
-
output
-
file
=
"/dev/null"
}
# when using "stealing" as scheduler policy
work
-
stealing
{
# number of zero-sleep-interval polling attempts
aggressive
-
poll
-
attempts
=
100
# frequency of steal attempts during aggressive polling
aggressive
-
steal
-
interval
=
10
# number of moderately aggressive polling attempts
moderate
-
poll
-
attempts
=
500
# frequency of steal attempts during moderate polling
moderate
-
steal
-
interval
=
5
# sleep interval between poll attempts
moderate
-
sleep
-
duration
=
50
us
# frequency of steal attempts during relaxed polling
relaxed
-
steal
-
interval
=
1
# sleep interval between poll attempts
relaxed
-
sleep
-
duration
=
10
ms
}
# when loading io::middleman
middleman
{
# configures whether MMs try to span a full mesh
enable
-
automatic
-
connections
=
false
# application identifier of this node, prevents connection to other CAF
# 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
=
0
ms
# configures whether the MM attaches its internal utility actors to the
# example, "caf.scheduler.max-threads" has no hard-coded default and instead
# adjusts to the number of cores available.
caf
{
# Parameters selecting a default scheduler.
scheduler
{
# Use the work stealing implementation. Accepted alternative: "sharing".
policy
=
"stealing"
# Maximum number of messages actors can consume in single run (int64 max).
max
-
throughput
=
9223372036854775807
# # Maximum number of threads for the scheduler. No hardcoded default.
# max-threads = ... (detected at runtime)
}
# Prameters for the work stealing scheduler. Only takes effect if
# caf.scheduler.policy is set to "stealing".
work
-
stealing
{
# Number of zero-sleep-interval polling attempts.
aggressive
-
poll
-
attempts
=
100
# Frequency of steal attempts during aggressive polling.
aggressive
-
steal
-
interval
=
10
# Number of moderately aggressive polling attempts.
moderate
-
poll
-
attempts
=
500
# Frequency of steal attempts during moderate polling.
moderate
-
steal
-
interval
=
5
# Sleep interval between poll attempts.
moderate
-
sleep
-
duration
=
50
us
# Frequency of steal attempts during relaxed polling.
relaxed
-
steal
-
interval
=
1
# Sleep interval between poll attempts.
relaxed
-
sleep
-
duration
=
10
ms
}
# Parameters for the I/O module.
middleman
{
# Configures whether MMs try to span a full mesh.
enable
-
automatic
-
connections
=
false
# Application identifiers of this node, prevents connection to other CAF
# instances with incompatible identifiers.
app
-
identifiers
= [
"generic-caf-app"
]
# Maximum number of consecutive I/O reads per broker.
max
-
consecutive
-
reads
=
50
# Heartbeat message interval in ms (0 disables heartbeating).
heartbeat
-
interval
=
0
ms
# Configures whether the MM attaches its internal utility actors to the
# scheduler instead of dedicating individual threads (needed only for
# deterministic testing)
attach
-
utility
-
actors
=
false
# configures whether the MM starts a background thread for I/O activity,
# setting this to true allows fully deterministic execution in unit test and
# requires the user to trigger I/O manually
manual
-
multiplexing
=
false
# disables communication via TCP
disable
-
tcp
=
false
# enable communication via UDP
enable
-
udp
=
false
# configures how many background workers are spawned for deserialization,
# by default CAF uses 1-4 workers depending on the number of cores
# workers=... (detected at runtime)
}
# when compiling with logging enabled
logger
{
# file name template for output log file files (empty string disables logging)
file
-
name
=
"actor_log_[PID]_[TIMESTAMP]_[NODE].log"
# format for rendering individual log file entries
file
-
format
=
"%r %c %p %a %t %C %M %F:%L %m%n"
# configures the minimum severity of messages that are written to the log file
# (quiet|error|warning|info|debug|trace)
file
-
verbosity
=
"trace"
# mode for console log output generation (none|colored|uncolored)
console
=
"none"
# format for printing individual log entries to the console
console
-
format
=
"%m"
# configures the minimum severity of messages that are written to the console
# (quiet|error|warning|info|debug|trace)
console
-
verbosity
=
"trace"
# excludes listed components from logging (list of strings)
component
-
blacklist
=[]
# deterministic testing).
attach
-
utility
-
actors
=
false
# Configures whether the MM starts a background thread for I/O activity.
# Setting this to true allows fully deterministic execution in unit test and
# requires the user to trigger I/O manually.
manual
-
multiplexing
=
false
# # Configures how many background workers are spawned for deserialization.
# # No hardcoded default.
# workers = ... (detected at runtime)
}
# Parameters for logging.
logger
{
# # Note: File logging is disabled unless a 'file' section exists that
# # contains a setting for 'verbosity'.
# file {
# # File name template for output log files.
# path = "actor_log_[PID]_[TIMESTAMP]_[NODE].log"
# # Format for rendering individual log file entries.
# format = "%r %c %p %a %t %C %M %F:%L %m%n"
# # Minimum severity of messages that are written to the log. One of:
# # 'quiet', 'error', 'warning', 'info', 'debug', or 'trace'.
# verbosity = "trace"
# # A list of components to exclude in file output.
# excluded-components = []
# }
# # Note: Console output is disabled unless a 'console' section exists that
# # contains a setting for 'verbosity'.
# console {
# # Enabled colored output when writing to a TTY if set to true.
# colored = true
# # Format for printing log lines (implicit newline at the end).
# format = "[%c:%p] %d %m"
# # 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 = []
# }
}
}
libcaf_core/caf/actor_system_config.hpp
View file @
2131e2cb
...
...
@@ -326,10 +326,6 @@ private:
actor_system_config
&
set_impl
(
string_view
name
,
config_value
value
);
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.
...
...
libcaf_core/caf/defaults.hpp
View file @
2131e2cb
...
...
@@ -68,33 +68,19 @@ constexpr auto relaxed_sleep_duration = timespan{10'000'000};
}
// namespace caf::defaults::work_stealing
namespace
caf
::
defaults
::
logger
{
constexpr
auto
default_log_level
=
string_view
{
#if CAF_LOG_LEVEL == CAF_LOG_LEVEL_TRACE
"trace"
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_DEBUG
"debug"
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_INFO
"info"
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_WARNING
"warning"
#elif CAF_LOG_LEVEL == CAF_LOG_LEVEL_ERROR
"error"
#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
::
logger
::
file
{
constexpr
auto
format
=
string_view
{
"%r %c %p %a %t %C %M %F:%L %m%n"
};
constexpr
auto
path
=
string_view
{
"actor_log_[PID]_[TIMESTAMP]_[NODE].log"
};
}
// namespace caf::defaults::logger::file
namespace
caf
::
defaults
::
logger
::
console
{
constexpr
auto
colored
=
true
;
constexpr
auto
format
=
string_view
{
"[%c:%p] %d %m"
};
}
// namespace caf::defaults::logger::console
namespace
caf
::
defaults
::
middleman
{
...
...
libcaf_core/caf/logger.hpp
View file @
2131e2cb
...
...
@@ -340,8 +340,15 @@ private:
// Configures verbosity and output generation.
config
cfg_
;
// Filters events by component name.
std
::
vector
<
std
::
string
>
component_blacklist
;
// Filters events by component name before enqueuing a log event. Union of
// 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.
actor_system
&
system_
;
...
...
libcaf_core/src/actor_system.cpp
View file @
2131e2cb
...
...
@@ -320,7 +320,7 @@ actor_system::actor_system(actor_system_config& cfg)
};
sched_conf
sc
=
stealing
;
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"
)
sc
=
sharing
;
else
if
(
sr_policy
==
"testing"
)
...
...
libcaf_core/src/actor_system_config.cpp
View file @
2131e2cb
This diff is collapsed.
Click to expand it.
libcaf_core/src/config_option_set.cpp
View file @
2131e2cb
...
...
@@ -236,9 +236,7 @@ config_option_set::parse(settings& config,
}
config_option_set
::
option_pointer
config_option_set
::
cli_long_name_lookup
(
string_view
input
)
const
{
// We accept "caf#" prefixes for backward compatibility, but ignore them.
auto
name
=
input
.
substr
(
input
.
compare
(
0
,
4
,
"caf#"
)
!=
0
?
0u
:
4u
);
config_option_set
::
cli_long_name_lookup
(
string_view
name
)
const
{
// Extract category and long name.
string_view
category
;
string_view
long_name
;
...
...
libcaf_core/src/group_manager.cpp
View file @
2131e2cb
...
...
@@ -55,7 +55,7 @@ void await_all_locals_down(actor_system& sys, std::initializer_list<actor> xs) {
ys
.
push_back
(
x
);
}
// 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"
)
self
->
wait_for
(
ys
);
}
...
...
libcaf_core/src/inbound_path.cpp
View file @
2131e2cb
...
...
@@ -78,7 +78,7 @@ inbound_path::inbound_path(stream_manager_ptr mgr_ptr, stream_slots id,
<<
detail
::
global_meta_object
(
in_type
)
->
type_name
<<
"at slot"
<<
id
.
receiver
<<
"from"
<<
hdl
);
if
(
auto
str
=
get_if
<
std
::
string
>
(
&
self
()
->
system
().
config
(),
"stream.credit-policy"
))
{
"
caf.
stream.credit-policy"
))
{
if
(
*
str
==
"testing"
)
controller_
.
reset
(
new
detail
::
test_credit_controller
(
self
()));
else
if
(
*
str
==
"size"
)
...
...
libcaf_core/src/logger.cpp
View file @
2131e2cb
...
...
@@ -283,7 +283,7 @@ logger* logger::current_logger() {
bool
logger
::
accepts
(
unsigned
level
,
string_view
cname
)
{
if
(
level
>
cfg_
.
verbosity
)
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
;
});
}
...
...
@@ -302,51 +302,48 @@ logger::~logger() {
void
logger
::
init
(
actor_system_config
&
cfg
)
{
CAF_IGNORE_UNUSED
(
cfg
);
namespace
lg
=
defaults
::
logger
;
using
std
::
string
;
using
string_list
=
std
::
vector
<
std
::
string
>
;
auto
blacklist
=
get_if
<
string_list
>
(
&
cfg
,
"logger.component-blacklist"
);
if
(
blacklist
)
component_blacklist
=
move_if_optional
(
blacklist
);
// Parse the configured log level. We only store a string_view to the
// 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
;
auto
get_verbosity
=
[
&
cfg
](
string_view
key
)
->
unsigned
{
if
(
auto
str
=
get_if
<
string
>
(
&
cfg
,
key
))
return
to_level_int
(
*
str
);
return
CAF_LOG_LEVEL_QUIET
;
};
string_view
file_str
;
string_view
console_str
;
set_level
(
file_str
,
lg
::
file_verbosity
,
"logger.file-verbosity"
);
set_level
(
console_str
,
lg
::
console_verbosity
,
"logger.console-verbosity"
)
;
cfg_
.
file_verbosity
=
to_level_int
(
file_str
);
cfg_
.
console_verbosity
=
to_level_int
(
console_str
);
auto
read_filter
=
[
&
cfg
](
string_list
&
var
,
string_view
key
)
{
if
(
auto
lst
=
get_if
<
string_list
>
(
&
cfg
,
key
))
var
=
std
::
move
(
*
lst
);
}
;
cfg_
.
file_verbosity
=
get_verbosity
(
"caf.logger.file.verbosity"
);
cfg_
.
console_verbosity
=
get_verbosity
(
"caf.logger.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.
file_format_
=
parse_format
(
get_or
(
cfg
,
"logger.file-format"
,
lg
::
file_
format
));
console_format_
=
parse_format
(
get_or
(
cfg
,
"logger.console-format"
,
lg
::
console_
format
));
file_format_
=
parse_format
(
get_or
(
cfg
,
"caf.logger.file.format"
,
lg
::
file
::
format
));
console_format_
=
parse_format
(
get_or
(
cfg
,
"caf.logger.console.format"
,
lg
::
console
::
format
));
// Set flags.
if
(
get_or
(
cfg
,
"logger.inline-output"
,
false
))
if
(
get_or
(
cfg
,
"
caf.
logger.inline-output"
,
false
))
cfg_
.
inline_output
=
true
;
auto
con
=
get_or
(
cfg
,
"logger.console"
,
lg
::
console
);
if
(
con
==
"colored"
)
{
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
;
}
// If not set to `false`, CAF enables colored output when writing to TTYs.
cfg_
.
console_coloring
=
get_or
(
cfg
,
"caf.logger.console.colored"
,
true
);
}
bool
logger
::
open_file
()
{
...
...
@@ -572,21 +569,20 @@ void logger::handle_event(const event& x) {
void
logger
::
log_first_line
()
{
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
)
{
std
::
string
msg
=
"level = "
;
msg
+=
get_or
(
system_
.
config
(),
config_name
,
default_value
);
auto
make_message
=
[
&
](
int
level
,
const
auto
&
filter
)
{
auto
lvl_str
=
log_level_name
[
level
];
std
::
string
msg
=
"verbosity = "
;
msg
.
insert
(
msg
.
end
(),
lvl_str
.
begin
(),
lvl_str
.
end
());
msg
+=
", node = "
;
msg
+=
to_string
(
system_
.
node
());
msg
+=
",
component-blacklist
= "
;
msg
+=
deep_to_string
(
component_blacklist
);
msg
+=
",
excluded-components
= "
;
msg
+=
deep_to_string
(
filter
);
return
msg
;
};
namespace
lg
=
defaults
::
logger
;
e
.
message
=
make_message
(
"logger.file-verbosity"
,
to_string
(
lg
::
file_verbosity
));
e
.
message
=
make_message
(
cfg_
.
file_verbosity
,
file_filter_
);
handle_file_event
(
e
);
e
.
message
=
make_message
(
"logger.console-verbosity"
,
to_string
(
lg
::
console_verbosity
));
e
.
message
=
make_message
(
cfg_
.
console_verbosity
,
console_filter_
);
handle_console_event
(
e
);
}
...
...
@@ -599,8 +595,8 @@ void logger::start() {
parent_thread_
=
std
::
this_thread
::
get_id
();
if
(
verbosity
()
==
CAF_LOG_LEVEL_QUIET
)
return
;
file_name_
=
get_or
(
system_
.
config
(),
"
logger.file-name
"
,
defaults
::
logger
::
file_name
);
file_name_
=
get_or
(
system_
.
config
(),
"
caf.logger.file.path
"
,
defaults
::
logger
::
file
::
path
);
if
(
file_name_
.
empty
())
{
// No need to continue if console and log file are disabled.
if
(
console_verbosity
()
==
CAF_LOG_LEVEL_QUIET
)
...
...
libcaf_core/src/scheduler/abstract_coordinator.cpp
View file @
2131e2cb
...
...
@@ -247,8 +247,9 @@ void abstract_coordinator::start() {
void
abstract_coordinator
::
init
(
actor_system_config
&
cfg
)
{
namespace
sr
=
defaults
::
scheduler
;
max_throughput_
=
get_or
(
cfg
,
"scheduler.max-throughput"
,
sr
::
max_throughput
);
if
(
auto
num_workers
=
get_if
<
size_t
>
(
&
cfg
,
"scheduler.max-threads"
))
max_throughput_
=
get_or
(
cfg
,
"caf.scheduler.max-throughput"
,
sr
::
max_throughput
);
if
(
auto
num_workers
=
get_if
<
size_t
>
(
&
cfg
,
"caf.scheduler.max-threads"
))
num_workers_
=
*
num_workers
;
else
num_workers_
=
default_thread_count
();
...
...
libcaf_core/test/actor_lifetime.cpp
View file @
2131e2cb
...
...
@@ -109,7 +109,7 @@ behavior tester(event_based_actor* self, const actor& aut) {
struct
config
:
actor_system_config
{
config
()
{
set
(
"scheduler.policy"
,
"testing"
);
set
(
"
caf.
scheduler.policy"
,
"testing"
);
}
};
...
...
libcaf_core/test/logger.cpp
View file @
2131e2cb
...
...
@@ -61,7 +61,9 @@ namespace {
struct
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
)
{
...
...
@@ -161,10 +163,7 @@ CAF_TEST(parse_default_format_strings) {
add
(
logger
::
message_field
);
add
(
logger
::
newline_field
);
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
);
#endif
}
CAF_TEST
(
rendering
)
{
...
...
libcaf_core/test/native_streaming_classes.cpp
View file @
2131e2cb
...
...
@@ -530,7 +530,7 @@ struct fixture {
if
(
auto
err
=
cfg
.
parse
(
caf
::
test
::
engine
::
argc
(),
caf
::
test
::
engine
::
argv
()))
CAF_FAIL
(
"parsing the config failed: "
<<
to_string
(
err
));
cfg
.
set
(
"scheduler.policy"
,
"testing"
);
cfg
.
set
(
"
caf.
scheduler.policy"
,
"testing"
);
return
cfg
;
}
...
...
libcaf_core/test/thread_hook.cpp
View file @
2131e2cb
...
...
@@ -116,7 +116,7 @@ CAF_TEST_FIXTURE_SCOPE(counting_hook, fixture<counting_thread_hook>)
CAF_TEST
(
counting_system_without_actor
)
{
assumed_init_calls
=
1
;
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
auto
&
sched
=
sys
.
scheduler
();
if
(
sched
.
detaches_utility_actors
())
...
...
@@ -126,7 +126,7 @@ CAF_TEST(counting_system_without_actor) {
CAF_TEST
(
counting_system_with_actor
)
{
assumed_init_calls
=
1
;
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
auto
&
sched
=
sys
.
scheduler
();
if
(
sched
.
detaches_utility_actors
())
...
...
libcaf_io/src/io/basp/instance.cpp
View file @
2131e2cb
...
...
@@ -44,7 +44,7 @@ instance::instance(abstract_broker* parent, callee& lstnr)
:
tbl_
(
parent
),
this_node_
(
parent
->
system
().
node
()),
callee_
(
lstnr
)
{
CAF_ASSERT
(
this_node_
!=
none
);
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
;
else
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,
auto
writer
=
make_callback
([
&
](
binary_serializer
&
sink
)
{
using
string_list
=
std
::
vector
<
std
::
string
>
;
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
);
else
app_ids
.
emplace_back
(
to_string
(
defaults
::
middleman
::
app_identifier
));
...
...
@@ -323,7 +324,8 @@ connection_state instance::handle(execution_unit* ctx, connection_handle hdl,
}
// Check the application ID.
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
);
else
whitelist
.
emplace_back
(
to_string
(
defaults
::
middleman
::
app_identifier
));
...
...
libcaf_io/src/io/basp_broker.cpp
View file @
2131e2cb
...
...
@@ -105,7 +105,7 @@ behavior basp_broker::make_behavior() {
set_down_handler
([](
local_actor
*
ptr
,
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"
);
// open a random port and store a record for our peers how to
// connect to this broker directly in the configuration server
...
...
@@ -120,7 +120,7 @@ behavior basp_broker::make_behavior() {
}
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
);
if
(
heartbeat_interval
>
0
)
{
CAF_LOG_DEBUG
(
"enable heartbeat"
<<
CAF_ARG
(
heartbeat_interval
));
...
...
@@ -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
// once and there is no need to track in-flight connection requests.
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
<
detached
+
hidden
>
(
connection_helper
,
this
);
auto
sender
=
actor_cast
<
strong_actor_ptr
>
(
tmp
);
...
...
libcaf_io/src/io/middleman.cpp
View file @
2131e2cb
...
...
@@ -87,7 +87,7 @@ void middleman::init_global_meta_objects() {
}
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
);
if
(
impl
==
"testing"
)
return
new
mm_impl
<
network
::
test_multiplexer
>
(
sys
);
...
...
@@ -272,7 +272,7 @@ strong_actor_ptr middleman::remote_lookup(std::string name,
void
middleman
::
start
()
{
CAF_LOG_TRACE
(
""
);
// Launch backend.
if
(
!
get_or
(
config
(),
"middleman.manual-multiplexing"
,
false
))
if
(
!
get_or
(
config
(),
"
caf.
middleman.manual-multiplexing"
,
false
))
backend_supervisor_
=
backend
().
make_supervisor
();
// The only backend that returns a `nullptr` by default is the
// `test_multiplexer` which does not have its own thread but uses the main
...
...
@@ -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
();
if
(
thread_
.
joinable
())
thread_
.
join
();
...
...
@@ -343,7 +343,7 @@ void middleman::stop() {
named_brokers_
.
clear
();
scoped_actor
self
{
system
(),
true
};
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_
);
destroy
(
manager_
);
}
...
...
@@ -351,11 +351,11 @@ void middleman::stop() {
void
middleman
::
init
(
actor_system_config
&
cfg
)
{
// Note: logging is not available at this stage.
// 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
);
if
(
network_backend
==
"testing"
)
{
cfg
.
set
(
"middleman.attach-utility-actors"
,
true
)
.
set
(
"middleman.manual-multiplexing"
,
true
);
cfg
.
set
(
"
caf.
middleman.attach-utility-actors"
,
true
)
.
set
(
"
caf.
middleman.manual-multiplexing"
,
true
);
}
// Add remote group module to config.
struct
remote_groups
:
group_module
{
...
...
libcaf_io/src/io/middleman_actor.cpp
View file @
2131e2cb
...
...
@@ -31,7 +31,7 @@
namespace
caf
::
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
,
hidden
>
(
std
::
move
(
db
))
:
sys
.
spawn
<
middleman_actor_impl
,
detached
+
hidden
>
(
std
::
move
(
db
));
}
...
...
libcaf_io/src/io/network/datagram_handler.cpp
View file @
2131e2cb
...
...
@@ -39,7 +39,7 @@ datagram_handler::datagram_handler(default_multiplexer& backend_ref,
native_socket
sockfd
)
:
event_handler
(
backend_ref
,
sockfd
),
max_consecutive_reads_
(
get_or
(
backend
().
system
().
config
(),
"middleman.max-consecutive-reads"
,
"
caf.
middleman.max-consecutive-reads"
,
defaults
::
middleman
::
max_consecutive_reads
)),
max_datagram_size_
(
receive_buffer_size
),
rd_buf_
(
receive_buffer_size
),
...
...
libcaf_io/src/io/network/default_multiplexer.cpp
View file @
2131e2cb
...
...
@@ -589,8 +589,8 @@ void default_multiplexer::init() {
}
#endif
namespace
sr
=
defaults
::
scheduler
;
max_throughput_
=
get_or
(
system
().
config
(),
"scheduler.max-throughput"
,
sr
::
max_throughput
);
max_throughput_
=
get_or
(
system
().
config
(),
"caf.scheduler.max-throughput"
,
sr
::
max_throughput
);
}
bool
default_multiplexer
::
poll_once
(
bool
block
)
{
...
...
libcaf_io/src/io/network/stream.cpp
View file @
2131e2cb
...
...
@@ -31,7 +31,7 @@ namespace caf::io::network {
stream
::
stream
(
default_multiplexer
&
backend_ref
,
native_socket
sockfd
)
:
event_handler
(
backend_ref
,
sockfd
),
max_consecutive_reads_
(
get_or
(
backend
().
system
().
config
(),
"middleman.max-consecutive-reads"
,
"
caf.
middleman.max-consecutive-reads"
,
defaults
::
middleman
::
max_consecutive_reads
)),
read_threshold_
(
1
),
collected_
(
0
),
...
...
libcaf_io/test/io/basp_broker.cpp
View file @
2131e2cb
...
...
@@ -105,10 +105,10 @@ class fixture {
public:
fixture
(
bool
autoconn
=
false
)
:
sys
(
cfg
.
load
<
io
::
middleman
,
network
::
test_multiplexer
>
()
.
set
(
"middleman.enable-automatic-connections"
,
autoconn
)
.
set
(
"middleman.workers"
,
size_t
{
0
})
.
set
(
"scheduler.policy"
,
autoconn
?
"testing"
:
"stealing"
)
.
set
(
"middleman.attach-utility-actors"
,
autoconn
))
{
.
set
(
"
caf.
middleman.enable-automatic-connections"
,
autoconn
)
.
set
(
"
caf.
middleman.workers"
,
size_t
{
0
})
.
set
(
"
caf.
scheduler.policy"
,
autoconn
?
"testing"
:
"stealing"
)
.
set
(
"
caf.
middleman.attach-utility-actors"
,
autoconn
))
{
app_ids
.
emplace_back
(
to_string
(
defaults
::
middleman
::
app_identifier
));
auto
&
mm
=
sys
.
middleman
();
mpx_
=
dynamic_cast
<
network
::
test_multiplexer
*>
(
&
mm
.
backend
());
...
...
libcaf_openssl/src/openssl/manager.cpp
View file @
2131e2cb
...
...
@@ -104,7 +104,7 @@ void manager::stop() {
CAF_LOG_TRACE
(
""
);
scoped_actor
self
{
system
(),
true
};
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_
);
manager_
=
nullptr
;
}
...
...
libcaf_openssl/src/openssl/middleman_actor.cpp
View file @
2131e2cb
...
...
@@ -284,7 +284,7 @@ private:
}
// namespace
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
,
hidden
>
(
std
::
move
(
db
));
}
...
...
libcaf_openssl/test/openssl/authentication.cpp
View file @
2131e2cb
...
...
@@ -54,9 +54,9 @@ public:
config
()
{
load
<
io
::
middleman
>
();
load
<
openssl
::
manager
>
();
set
(
"middleman.manual-multiplexing"
,
true
);
set
(
"middleman.attach-utility-actors"
,
true
);
set
(
"scheduler.policy"
,
"testing"
);
set
(
"
caf.
middleman.manual-multiplexing"
,
true
);
set
(
"
caf.
middleman.attach-utility-actors"
,
true
);
set
(
"
caf.
scheduler.policy"
,
"testing"
);
}
static
std
::
string
data_dir
()
{
...
...
libcaf_openssl/test/openssl/remote_actor.cpp
View file @
2131e2cb
...
...
@@ -45,7 +45,7 @@ public:
// OpenSSL to buffer data internally and report "pending" data after a read
// operation. This will trigger `must_read_more` in the SSL read policy
// with high probability.
set
(
"middleman.max-consecutive-reads"
,
1
);
set
(
"
caf.
middleman.max-consecutive-reads"
,
1
);
}
};
...
...
libcaf_test/caf/test/dsl.hpp
View file @
2131e2cb
...
...
@@ -674,16 +674,15 @@ public:
// -- constructors, destructors, and assignment operators --------------------
static
Config
&
init_config
(
Config
&
cfg
)
{
cfg
.
set
(
"logger.file-verbosity"
,
"quiet"
);
if
(
auto
err
=
cfg
.
parse
(
caf
::
test
::
engine
::
argc
(),
caf
::
test
::
engine
::
argv
()))
CAF_FAIL
(
"failed to parse config: "
<<
to_string
(
err
));
cfg
.
set
(
"scheduler.policy"
,
"testing"
);
cfg
.
set
(
"logger.inline-output"
,
true
);
cfg
.
set
(
"middleman.network-backend"
,
"testing"
);
cfg
.
set
(
"middleman.manual-multiplexing"
,
true
);
cfg
.
set
(
"middleman.workers"
,
size_t
{
0
});
cfg
.
set
(
"stream.credit-policy"
,
"testing"
);
cfg
.
set
(
"
caf.
scheduler.policy"
,
"testing"
);
cfg
.
set
(
"
caf.
logger.inline-output"
,
true
);
cfg
.
set
(
"
caf.
middleman.network-backend"
,
"testing"
);
cfg
.
set
(
"
caf.
middleman.manual-multiplexing"
,
true
);
cfg
.
set
(
"
caf.
middleman.workers"
,
size_t
{
0
});
cfg
.
set
(
"
caf.
stream.credit-policy"
,
"testing"
);
return
cfg
;
}
...
...
tools/caf-run.cpp
View file @
2131e2cb
...
...
@@ -176,10 +176,10 @@ void bootstrap(actor_system& system, const string& wdir,
std
::
ostringstream
oss
;
oss
<<
cmd
;
if
(
slave
.
cpu_slots
>
0
)
oss
<<
" --caf
#
scheduler.max-threads="
<<
slave
.
cpu_slots
;
oss
<<
" --caf
#
slave-mode"
<<
" --caf
#
slave-name="
<<
slave
.
host
<<
" --caf
#
bootstrap-node="
;
oss
<<
" --caf
.
scheduler.max-threads="
<<
slave
.
cpu_slots
;
oss
<<
" --caf
.
slave-mode"
<<
" --caf
.
slave-name="
<<
slave
.
host
<<
" --caf
.
bootstrap-node="
;
bool
is_first
=
true
;
interfaces
::
traverse
({
protocol
::
ipv4
,
protocol
::
ipv6
},
[
&
](
const
char
*
,
protocol
::
network
,
...
...
@@ -216,7 +216,7 @@ void bootstrap(actor_system& system, const string& wdir,
}
// run (and wait for) master
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
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment