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
975a8c1d
Commit
975a8c1d
authored
Jun 17, 2016
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Make remote_lookup more efficient
parent
e0e7e4da
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
4 deletions
+13
-4
libcaf_core/src/actor_system.cpp
libcaf_core/src/actor_system.cpp
+8
-0
libcaf_io/src/header.cpp
libcaf_io/src/header.cpp
+1
-1
libcaf_io/src/middleman.cpp
libcaf_io/src/middleman.cpp
+4
-3
No files found.
libcaf_core/src/actor_system.cpp
View file @
975a8c1d
...
...
@@ -73,6 +73,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
unsubscribe_all
(
actor_cast
<
actor
>
(
std
::
move
(
ptr
)));
});
return
{
// set a key/value pair
[
=
](
put_atom
,
const
std
::
string
&
key
,
message
&
msg
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
key
)
<<
CAF_ARG
(
msg
));
if
(
key
==
"*"
)
...
...
@@ -91,6 +92,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
self
->
send
(
actor_cast
<
actor
>
(
subscriber
),
update_atom
::
value
,
key
,
vp
.
second
);
},
// get a key/value pair
[
=
](
get_atom
,
std
::
string
&
key
)
->
message
{
CAF_LOG_TRACE
(
CAF_ARG
(
key
));
if
(
key
==
wildcard
)
{
...
...
@@ -105,6 +107,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
i
!=
self
->
state
.
data
.
end
()
?
i
->
second
.
first
:
make_message
());
},
// subscribe to a key
[
=
](
subscribe_atom
,
const
std
::
string
&
key
)
{
auto
subscriber
=
actor_cast
<
strong_actor_ptr
>
(
self
->
current_sender
());
CAF_LOG_TRACE
(
CAF_ARG
(
key
)
<<
CAF_ARG
(
subscriber
));
...
...
@@ -120,6 +123,7 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
subscribers
.
emplace
(
subscriber
,
kvstate
::
topic_set
{
key
});
}
},
// unsubscribe from a key
[
=
](
unsubscribe_atom
,
const
std
::
string
&
key
)
{
auto
subscriber
=
actor_cast
<
strong_actor_ptr
>
(
self
->
current_sender
());
if
(
!
subscriber
)
...
...
@@ -131,6 +135,10 @@ behavior config_serv_impl(stateful_actor<kvstate>* self) {
}
self
->
state
.
subscribers
[
subscriber
].
erase
(
key
);
self
->
state
.
data
[
key
].
second
.
erase
(
subscriber
);
},
// get a 'named' actor from local registry
[
=
](
get_atom
,
atom_value
name
)
{
return
self
->
home_system
().
registry
().
get
(
name
);
}
};
}
...
...
libcaf_io/src/header.cpp
View file @
975a8c1d
...
...
@@ -29,7 +29,7 @@ const uint8_t header::named_receiver_flag;
std
::
string
to_bin
(
uint8_t
x
)
{
std
::
string
res
;
for
(
auto
offset
=
7
;
offset
>
0
;
--
offset
)
for
(
auto
offset
=
7
;
offset
>
-
1
;
--
offset
)
res
+=
std
::
to_string
((
x
>>
offset
)
&
0x01
);
return
res
;
}
...
...
libcaf_io/src/middleman.cpp
View file @
975a8c1d
...
...
@@ -251,12 +251,13 @@ strong_actor_ptr middleman::remote_lookup(atom_value name, const node_id& nid) {
auto
basp
=
named_broker
<
basp_broker
>
(
atom
(
"BASP"
));
strong_actor_ptr
result
;
scoped_actor
self
{
system
(),
true
};
self
->
set_default_handler
(
print_and_drop
);
try
{
self
->
send
(
basp
,
forward_atom
::
value
,
actor_cast
<
strong_actor_ptr
>
(
self
),
nid
,
name
,
make_message
(
sys_atom
::
value
,
get_atom
::
value
,
"info"
));
nid
,
atom
(
"ConfigServ"
)
,
make_message
(
get_atom
::
value
,
name
));
self
->
receive
(
[
&
](
ok_atom
,
std
::
string
&
,
strong_actor_ptr
&
addr
,
std
::
string
&
)
{
[
&
](
strong_actor_ptr
&
addr
)
{
result
=
std
::
move
(
addr
);
},
after
(
std
::
chrono
::
minutes
(
5
))
>>
[]
{
...
...
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