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
9f40d339
Commit
9f40d339
authored
Feb 24, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use only the local slot ID as scatterer path key
parent
b52b3770
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
19 additions
and
15 deletions
+19
-15
libcaf_core/caf/broadcast_scatterer.hpp
libcaf_core/caf/broadcast_scatterer.hpp
+8
-4
libcaf_core/caf/stream_scatterer.hpp
libcaf_core/caf/stream_scatterer.hpp
+3
-3
libcaf_core/src/stream_manager.cpp
libcaf_core/src/stream_manager.cpp
+3
-3
libcaf_core/src/stream_scatterer.cpp
libcaf_core/src/stream_scatterer.cpp
+5
-5
No files found.
libcaf_core/caf/broadcast_scatterer.hpp
View file @
9f40d339
...
...
@@ -36,11 +36,11 @@ public:
using
cache_type
=
std
::
vector
<
T
>
;
/// Maps slot IDs to caches.
using
cache_map_type
=
detail
::
unordered_flat_map
<
stream_slot
s
,
cache_type
>
;
using
cache_map_type
=
detail
::
unordered_flat_map
<
stream_slot
,
cache_type
>
;
typename
super
::
path_ptr
add_path
(
stream_slots
slots
,
strong_actor_ptr
target
)
override
{
auto
res
=
caches_
.
emplace
(
slots
,
cache_type
{});
auto
res
=
caches_
.
emplace
(
slots
.
sender
,
cache_type
{});
return
res
.
second
?
super
::
add_path
(
slots
,
target
)
:
nullptr
;
}
...
...
@@ -59,7 +59,8 @@ public:
}
void
force_emit_batches
()
override
{
CAF_LOG_TRACE
(
""
);
CAF_LOG_TRACE
(
CAF_ARG2
(
"buffered"
,
this
->
buffered
())
<<
CAF_ARG2
(
"paths"
,
this
->
paths_
.
size
()));
// Handler for the last (underful) batch that sends it anyway.
auto
f
=
[
&
](
outbound_path
&
p
,
cache_type
&
c
)
{
p
.
emit_batch
(
this
->
self_
,
c
.
size
(),
make_message
(
std
::
move
(
c
)));
...
...
@@ -70,7 +71,8 @@ public:
protected:
void
about_to_erase
(
typename
super
::
map_type
::
iterator
i
,
bool
silent
,
error
*
reason
)
override
{
caches_
.
erase
(
i
->
second
->
slots
);
CAF_LOG_DEBUG
(
"remove cache:"
<<
CAF_ARG2
(
"slot"
,
i
->
second
->
slots
.
sender
));
caches_
.
erase
(
i
->
second
->
slots
.
sender
);
super
::
about_to_erase
(
i
,
silent
,
reason
);
}
...
...
@@ -98,6 +100,8 @@ private:
if
(
this
->
paths_
.
empty
())
return
;
auto
emit_impl
=
[
&
](
outbound_path
&
p
,
cache_type
&
c
)
{
CAF_LOG_DEBUG
(
"emit up to"
<<
c
.
size
()
<<
"items on slot"
<<
p
.
slots
.
sender
);
if
(
c
.
empty
())
return
;
auto
dbs
=
p
.
desired_batch_size
;
...
...
libcaf_core/caf/stream_scatterer.hpp
View file @
9f40d339
...
...
@@ -44,7 +44,7 @@ public:
using
path_unique_ptr
=
std
::
unique_ptr
<
path_type
>
;
using
map_type
=
detail
::
unordered_flat_map
<
stream_slot
s
,
path_unique_ptr
>
;
using
map_type
=
detail
::
unordered_flat_map
<
stream_slot
,
path_unique_ptr
>
;
// -- constructors, destructors, and assignment operators --------------------
...
...
@@ -64,10 +64,10 @@ public:
virtual
path_ptr
add_path
(
stream_slots
slots
,
strong_actor_ptr
target
);
/// Removes a path from the scatterer and returns it.
path_unique_ptr
take_path
(
stream_slot
s
slots
)
noexcept
;
path_unique_ptr
take_path
(
stream_slot
slots
)
noexcept
;
/// Returns the path associated to `slots` or `nullptr`.
path_ptr
path
(
stream_slot
s
slots
)
noexcept
;
path_ptr
path
(
stream_slot
slots
)
noexcept
;
/// Returns the stored state for `x` if `x` is a known path and associated to
/// `sid`, otherwise `nullptr`.
...
...
libcaf_core/src/stream_manager.cpp
View file @
9f40d339
...
...
@@ -70,7 +70,7 @@ void stream_manager::handle(stream_slots slots, upstream_msg::ack_open& x) {
void
stream_manager
::
handle
(
stream_slots
slots
,
upstream_msg
::
ack_batch
&
x
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
slots
)
<<
CAF_ARG
(
x
));
auto
path
=
out
().
path
(
slots
.
invert
()
);
auto
path
=
out
().
path
(
slots
.
receiver
);
if
(
path
!=
nullptr
)
{
path
->
open_credit
+=
x
.
new_capacity
;
path
->
desired_batch_size
=
x
.
desired_batch_size
;
...
...
@@ -80,11 +80,11 @@ void stream_manager::handle(stream_slots slots, upstream_msg::ack_batch& x) {
}
void
stream_manager
::
handle
(
stream_slots
slots
,
upstream_msg
::
drop
&
)
{
out
().
take_path
(
slots
.
invert
()
);
out
().
take_path
(
slots
.
receiver
);
}
void
stream_manager
::
handle
(
stream_slots
slots
,
upstream_msg
::
forced_drop
&
x
)
{
if
(
out
().
path
(
slots
.
invert
()
)
!=
nullptr
)
if
(
out
().
path
(
slots
.
receiver
)
!=
nullptr
)
abort
(
std
::
move
(
x
.
reason
));
}
...
...
libcaf_core/src/stream_scatterer.cpp
View file @
9f40d339
...
...
@@ -47,7 +47,7 @@ stream_scatterer::~stream_scatterer() {
pointer
stream_scatterer
::
add_path
(
stream_slots
slots
,
strong_actor_ptr
target
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
slots
)
<<
CAF_ARG
(
target
));
auto
res
=
paths_
.
emplace
(
slots
,
nullptr
);
auto
res
=
paths_
.
emplace
(
slots
.
sender
,
nullptr
);
if
(
res
.
second
)
{
auto
ptr
=
new
outbound_path
(
slots
,
std
::
move
(
target
));
res
.
first
->
second
.
reset
(
ptr
);
...
...
@@ -56,9 +56,9 @@ pointer stream_scatterer::add_path(stream_slots slots,
return
nullptr
;
}
unique_pointer
stream_scatterer
::
take_path
(
stream_slot
s
slots
)
noexcept
{
unique_pointer
stream_scatterer
::
take_path
(
stream_slot
slot
)
noexcept
{
unique_pointer
result
;
auto
i
=
paths_
.
find
(
slot
s
);
auto
i
=
paths_
.
find
(
slot
);
if
(
i
!=
paths_
.
end
())
{
result
.
swap
(
i
->
second
);
paths_
.
erase
(
i
);
...
...
@@ -66,8 +66,8 @@ unique_pointer stream_scatterer::take_path(stream_slots slots) noexcept {
return
result
;
}
pointer
stream_scatterer
::
path
(
stream_slot
s
slots
)
noexcept
{
auto
i
=
paths_
.
find
(
slot
s
);
pointer
stream_scatterer
::
path
(
stream_slot
slot
)
noexcept
{
auto
i
=
paths_
.
find
(
slot
);
return
i
!=
paths_
.
end
()
?
i
->
second
.
get
()
:
nullptr
;
}
...
...
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