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
49333dc6
Commit
49333dc6
authored
Apr 14, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow users to trigger new credit
parent
ea760a5f
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
libcaf_core/caf/stream_manager.hpp
libcaf_core/caf/stream_manager.hpp
+4
-0
libcaf_core/src/stream_manager.cpp
libcaf_core/src/stream_manager.cpp
+26
-0
No files found.
libcaf_core/caf/stream_manager.hpp
View file @
49333dc6
...
...
@@ -67,6 +67,10 @@ public:
/// client.
virtual
void
stop
();
/// Tries to advance the stream by generating more credit or by sending
/// batches.
void
advance
();
/// Aborts a stream after any stream message handler returned a non-default
/// constructed error `reason` or the parent actor terminates with a
/// non-default error.
...
...
libcaf_core/src/stream_manager.cpp
View file @
49333dc6
...
...
@@ -21,6 +21,8 @@
#include "caf/actor_addr.hpp"
#include "caf/actor_cast.hpp"
#include "caf/actor_control_block.hpp"
#include "caf/actor_system.hpp"
#include "caf/actor_system_config.hpp"
#include "caf/error.hpp"
#include "caf/expected.hpp"
#include "caf/inbound_path.hpp"
...
...
@@ -112,6 +114,30 @@ void stream_manager::stop() {
self_
->
erase_inbound_paths_later
(
this
);
}
void
stream_manager
::
advance
()
{
CAF_LOG_TRACE
(
""
);
// Try to emit more credit.
if
(
!
inbound_paths_
.
empty
())
{
using
std
::
chrono
::
microseconds
;
auto
&
cfg
=
self_
->
system
().
config
();
microseconds
bc
{
cfg
.
streaming_desired_batch_complexity_us
};
microseconds
interval
{
cfg
.
streaming_tick_duration_us
()};
auto
&
mbox
=
self_
->
mailbox
();
auto
&
qs
=
get
<
2
>
(
mbox
.
queue
().
queues
()).
queues
();
// Iterate all queues for inbound traffic.
for
(
auto
&
kvp
:
qs
)
{
auto
inptr
=
kvp
.
second
.
policy
().
handler
.
get
();
// Ignore inbound paths of other managers.
if
(
inptr
->
mgr
.
get
()
==
this
)
{
auto
bs
=
static_cast
<
int32_t
>
(
kvp
.
second
.
total_task_size
());
inptr
->
emit_ack_batch
(
self_
,
bs
,
interval
,
bc
);
}
}
}
// Try to generate more batches.
push
();
}
void
stream_manager
::
abort
(
error
reason
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
reason
));
out
().
abort
(
reason
);
...
...
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