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
dbfc77ce
Commit
dbfc77ce
authored
Jul 09, 2020
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Move config parameters to the modules
parent
31618916
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
28 deletions
+50
-28
libcaf_core/caf/actor_system_config.hpp
libcaf_core/caf/actor_system_config.hpp
+6
-0
libcaf_core/src/actor_system_config.cpp
libcaf_core/src/actor_system_config.cpp
+0
-26
libcaf_io/caf/io/middleman.hpp
libcaf_io/caf/io/middleman.hpp
+3
-0
libcaf_io/src/io/middleman.cpp
libcaf_io/src/io/middleman.cpp
+21
-0
libcaf_openssl/caf/openssl/manager.hpp
libcaf_openssl/caf/openssl/manager.hpp
+3
-0
libcaf_openssl/src/openssl/manager.cpp
libcaf_openssl/src/openssl/manager.cpp
+17
-2
No files found.
libcaf_core/caf/actor_system_config.hpp
View file @
dbfc77ce
...
@@ -152,6 +152,7 @@ public:
...
@@ -152,6 +152,7 @@ public:
/// Loads module `T` with optional template parameters `Ts...`.
/// Loads module `T` with optional template parameters `Ts...`.
template
<
class
T
,
class
...
Ts
>
template
<
class
T
,
class
...
Ts
>
actor_system_config
&
load
()
{
actor_system_config
&
load
()
{
T
::
add_module_options
(
*
this
);
module_factories
.
push_back
([](
actor_system
&
sys
)
->
actor_system
::
module
*
{
module_factories
.
push_back
([](
actor_system
&
sys
)
->
actor_system
::
module
*
{
return
T
::
make
(
sys
,
detail
::
type_list
<
Ts
...
>
{});
return
T
::
make
(
sys
,
detail
::
type_list
<
Ts
...
>
{});
});
});
...
@@ -319,6 +320,11 @@ public:
...
@@ -319,6 +320,11 @@ public:
static
error
parse_config
(
std
::
istream
&
source
,
const
config_option_set
&
opts
,
static
error
parse_config
(
std
::
istream
&
source
,
const
config_option_set
&
opts
,
settings
&
result
);
settings
&
result
);
/// @private
config_option_set
&
custom_options
()
{
return
custom_options_
;
}
protected:
protected:
config_option_set
custom_options_
;
config_option_set
custom_options_
;
...
...
libcaf_core/src/actor_system_config.cpp
View file @
dbfc77ce
...
@@ -110,32 +110,6 @@ actor_system_config::actor_system_config()
...
@@ -110,32 +110,6 @@ actor_system_config::actor_system_config()
.
add
<
string
>
(
"format"
,
"format for printed console lines"
)
.
add
<
string
>
(
"format"
,
"format for printed console lines"
)
.
add
<
string
>
(
"verbosity"
,
"minimum severity level for console output"
)
.
add
<
string
>
(
"verbosity"
,
"minimum severity level for console output"
)
.
add
<
string_list
>
(
"excluded-components"
,
"excluded components on console"
);
.
add
<
string_list
>
(
"excluded-components"
,
"excluded components on console"
);
opt_group
{
custom_options_
,
"caf.middleman"
}
.
add
<
std
::
string
>
(
"network-backend"
,
"either 'default' or 'asio' (if available)"
)
.
add
<
std
::
vector
<
string
>>
(
"app-identifiers"
,
"valid application identifiers of this node"
)
.
add
<
bool
>
(
"enable-automatic-connections"
,
"enables automatic connection management"
)
.
add
<
size_t
>
(
"max-consecutive-reads"
,
"max. number of consecutive reads per broker"
)
.
add
<
timespan
>
(
"heartbeat-interval"
,
"interval of heartbeat messages"
)
.
add
<
bool
>
(
"attach-utility-actors"
,
"schedule utility actors instead of dedicating threads"
)
.
add
<
bool
>
(
"manual-multiplexing"
,
"disables background activity of the multiplexer"
)
.
add
<
size_t
>
(
"workers"
,
"number of deserialization workers"
);
opt_group
(
custom_options_
,
"caf.openssl"
)
.
add
<
string
>
(
openssl_certificate
,
"certificate"
,
"path to the PEM-formatted certificate file"
)
.
add
<
string
>
(
openssl_key
,
"key"
,
"path to the private key file for this node"
)
.
add
<
string
>
(
openssl_passphrase
,
"passphrase"
,
"passphrase to decrypt the private key"
)
.
add
<
string
>
(
openssl_capath
,
"capath"
,
"path to an OpenSSL-style directory of trusted certificates"
)
.
add
<
string
>
(
openssl_cafile
,
"cafile"
,
"path to a file of concatenated PEM-formatted certificates"
);
}
}
settings
actor_system_config
::
dump_content
()
const
{
settings
actor_system_config
::
dump_content
()
const
{
...
...
libcaf_io/caf/io/middleman.hpp
View file @
dbfc77ce
...
@@ -261,6 +261,9 @@ public:
...
@@ -261,6 +261,9 @@ public:
const
char
*
in
=
nullptr
,
const
char
*
in
=
nullptr
,
bool
reuse
=
false
);
bool
reuse
=
false
);
/// Adds module-specific options to the config before loading the module.
static
void
add_module_options
(
actor_system_config
&
cfg
);
/// Returns a middleman using the default network backend.
/// Returns a middleman using the default network backend.
static
actor_system
::
module
*
make
(
actor_system
&
,
detail
::
type_list
<>
);
static
actor_system
::
module
*
make
(
actor_system
&
,
detail
::
type_list
<>
);
...
...
libcaf_io/src/io/middleman.cpp
View file @
dbfc77ce
...
@@ -86,6 +86,27 @@ void middleman::init_global_meta_objects() {
...
@@ -86,6 +86,27 @@ void middleman::init_global_meta_objects() {
caf
::
init_global_meta_objects
<
id_block
::
io_module
>
();
caf
::
init_global_meta_objects
<
id_block
::
io_module
>
();
}
}
void
middleman
::
add_module_options
(
actor_system_config
&
cfg
)
{
config_option_adder
{
cfg
.
custom_options
(),
"caf.middleman"
}
.
add
<
std
::
string
>
(
"network-backend"
,
"either 'default' or 'asio' (if available)"
)
.
add
<
std
::
vector
<
std
::
string
>>
(
"app-identifiers"
,
"valid application identifiers of this node"
)
.
add
<
bool
>
(
"enable-automatic-connections"
,
"enables automatic connection management"
)
.
add
<
size_t
>
(
"max-consecutive-reads"
,
"max. number of consecutive reads per broker"
)
.
add
<
timespan
>
(
"heartbeat-interval"
,
"interval of heartbeat messages"
)
.
add
<
bool
>
(
"attach-utility-actors"
,
"schedule utility actors instead of dedicating threads"
)
.
add
<
bool
>
(
"manual-multiplexing"
,
"disables background activity of the multiplexer"
)
.
add
<
size_t
>
(
"workers"
,
"number of deserialization workers"
);
config_option_adder
{
cfg
.
custom_options
(),
"caf.middleman.prometheus-http"
}
.
add
<
uint16_t
>
(
"port"
,
"listening port for incoming scrapes"
)
.
add
<
std
::
string
>
(
"address"
,
"bind address for the HTTP server socket"
);
}
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
(),
"caf.middleman.network-backend"
,
auto
impl
=
get_or
(
sys
.
config
(),
"caf.middleman.network-backend"
,
defaults
::
middleman
::
network_backend
);
defaults
::
middleman
::
network_backend
);
...
...
libcaf_openssl/caf/openssl/manager.hpp
View file @
dbfc77ce
...
@@ -62,6 +62,9 @@ public:
...
@@ -62,6 +62,9 @@ public:
/// of peers.
/// of peers.
bool
authentication_enabled
();
bool
authentication_enabled
();
/// Adds module-specific options to the config before loading the module.
static
void
add_module_options
(
actor_system_config
&
cfg
);
/// Returns an OpenSSL manager using the default network backend.
/// Returns an OpenSSL manager using the default network backend.
/// @warning Creating an OpenSSL manager will fail when using
/// @warning Creating an OpenSSL manager will fail when using
// a custom implementation.
// a custom implementation.
...
...
libcaf_openssl/src/openssl/manager.cpp
View file @
dbfc77ce
...
@@ -109,8 +109,7 @@ void manager::stop() {
...
@@ -109,8 +109,7 @@ void manager::stop() {
manager_
=
nullptr
;
manager_
=
nullptr
;
}
}
void
manager
::
init
(
actor_system_config
&
)
{
void
manager
::
init
(
actor_system_config
&
cfg
)
{
CAF_LOG_TRACE
(
""
);
ERR_load_crypto_strings
();
ERR_load_crypto_strings
();
OPENSSL_add_all_algorithms_conf
();
OPENSSL_add_all_algorithms_conf
();
SSL_library_init
();
SSL_library_init
();
...
@@ -150,6 +149,22 @@ bool manager::authentication_enabled() {
...
@@ -150,6 +149,22 @@ bool manager::authentication_enabled() {
||
!
cfg
.
openssl_cafile
.
empty
();
||
!
cfg
.
openssl_cafile
.
empty
();
}
}
void
manager
::
add_module_options
(
actor_system_config
&
cfg
)
{
config_option_adder
(
cfg
.
custom_options
(),
"caf.openssl"
)
.
add
<
std
::
string
>
(
cfg
.
openssl_certificate
,
"certificate"
,
"path to the PEM-formatted certificate file"
)
.
add
<
std
::
string
>
(
cfg
.
openssl_key
,
"key"
,
"path to the private key file for this node"
)
.
add
<
std
::
string
>
(
cfg
.
openssl_passphrase
,
"passphrase"
,
"passphrase to decrypt the private key"
)
.
add
<
std
::
string
>
(
cfg
.
openssl_capath
,
"capath"
,
"path to an OpenSSL-style directory of trusted certificates"
)
.
add
<
std
::
string
>
(
cfg
.
openssl_cafile
,
"cafile"
,
"path to a file of concatenated PEM-formatted certificates"
);
}
actor_system
::
module
*
manager
::
make
(
actor_system
&
sys
,
detail
::
type_list
<>
)
{
actor_system
::
module
*
manager
::
make
(
actor_system
&
sys
,
detail
::
type_list
<>
)
{
if
(
!
sys
.
has_middleman
())
if
(
!
sys
.
has_middleman
())
CAF_RAISE_ERROR
(
"Cannot start OpenSSL module without middleman."
);
CAF_RAISE_ERROR
(
"Cannot start OpenSSL module without middleman."
);
...
...
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