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
ea760a5f
Commit
ea760a5f
authored
Apr 14, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow stage drivers to signal congestions
parent
72e58355
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
6 deletions
+24
-6
libcaf_core/caf/detail/stream_stage_driver_impl.hpp
libcaf_core/caf/detail/stream_stage_driver_impl.hpp
+4
-3
libcaf_core/caf/detail/stream_stage_impl.hpp
libcaf_core/caf/detail/stream_stage_impl.hpp
+2
-2
libcaf_core/caf/stream_stage_driver.hpp
libcaf_core/caf/stream_stage_driver.hpp
+13
-0
libcaf_core/test/native_streaming_classes.cpp
libcaf_core/test/native_streaming_classes.cpp
+5
-1
No files found.
libcaf_core/caf/detail/stream_stage_driver_impl.hpp
View file @
ea760a5f
...
@@ -49,8 +49,10 @@ public:
...
@@ -49,8 +49,10 @@ public:
using
state_type
=
typename
trait
::
state
;
using
state_type
=
typename
trait
::
state
;
template
<
class
Init
>
template
<
class
Init
>
stream_stage_driver_impl
(
Init
init
,
Process
f
,
Finalize
fin
)
stream_stage_driver_impl
(
DownstreamManager
&
out
,
Init
init
,
Process
f
,
:
process_
(
std
::
move
(
f
)),
Finalize
fin
)
:
super
(
out
),
process_
(
std
::
move
(
f
)),
fin_
(
std
::
move
(
fin
))
{
fin_
(
std
::
move
(
fin
))
{
init
(
state_
);
init
(
state_
);
}
}
...
@@ -68,7 +70,6 @@ private:
...
@@ -68,7 +70,6 @@ private:
state_type
state_
;
state_type
state_
;
Process
process_
;
Process
process_
;
Finalize
fin_
;
Finalize
fin_
;
message
result_
;
};
};
}
// namespace detail
}
// namespace detail
...
...
libcaf_core/caf/detail/stream_stage_impl.hpp
View file @
ea760a5f
...
@@ -51,7 +51,7 @@ public:
...
@@ -51,7 +51,7 @@ public:
stream_stage_impl
(
scheduled_actor
*
self
,
Ts
&&
...
xs
)
stream_stage_impl
(
scheduled_actor
*
self
,
Ts
&&
...
xs
)
:
stream_manager
(
self
),
:
stream_manager
(
self
),
super
(
self
),
super
(
self
),
driver_
(
std
::
forward
<
Ts
>
(
xs
)...)
{
driver_
(
this
->
out_
,
std
::
forward
<
Ts
>
(
xs
)...)
{
// nop
// nop
}
}
...
@@ -74,7 +74,7 @@ public:
...
@@ -74,7 +74,7 @@ public:
}
}
bool
congested
()
const
noexcept
override
{
bool
congested
()
const
noexcept
override
{
return
this
->
out_
.
capacity
()
==
0
;
return
driver_
.
congested
()
;
}
}
int32_t
acquire_credit
(
inbound_path
*
path
,
int32_t
desired
)
override
{
int32_t
acquire_credit
(
inbound_path
*
path
,
int32_t
desired
)
override
{
...
...
libcaf_core/caf/stream_stage_driver.hpp
View file @
ea760a5f
...
@@ -53,6 +53,10 @@ public:
...
@@ -53,6 +53,10 @@ public:
// -- constructors, destructors, and assignment operators --------------------
// -- constructors, destructors, and assignment operators --------------------
stream_stage_driver
(
DownstreamManager
&
out
)
:
out_
(
out
)
{
// nop
}
virtual
~
stream_stage_driver
()
{
virtual
~
stream_stage_driver
()
{
// nop
// nop
}
}
...
@@ -68,6 +72,12 @@ public:
...
@@ -68,6 +72,12 @@ public:
// nop
// nop
}
}
/// Can mark the stage as congested. The default implementation signals a
/// congestion if the downstream manager has no capacity left in its buffer.
virtual
bool
congested
()
const
noexcept
{
return
out_
.
capacity
()
==
0
;
}
/// Acquires credit on an inbound path. The calculated credit to fill our
/// Acquires credit on an inbound path. The calculated credit to fill our
/// queue fro two cycles is `desired`, but the driver is allowed to return
/// queue fro two cycles is `desired`, but the driver is allowed to return
/// any non-negative value.
/// any non-negative value.
...
@@ -75,6 +85,9 @@ public:
...
@@ -75,6 +85,9 @@ public:
CAF_IGNORE_UNUSED
(
path
);
CAF_IGNORE_UNUSED
(
path
);
return
desired
;
return
desired
;
}
}
protected:
DownstreamManager
&
out_
;
};
};
}
// namespace caf
}
// namespace caf
...
...
libcaf_core/test/native_streaming_classes.cpp
View file @
ea760a5f
...
@@ -267,7 +267,11 @@ public:
...
@@ -267,7 +267,11 @@ public:
using
downstream_manager
=
broadcast_downstream_manager
<
int
>
;
using
downstream_manager
=
broadcast_downstream_manager
<
int
>
;
struct
driver
final
:
public
stream_stage_driver
<
int
,
downstream_manager
>
{
struct
driver
final
:
public
stream_stage_driver
<
int
,
downstream_manager
>
{
public:
public:
driver
(
vector
<
int
>*
log
)
:
log_
(
log
)
{
using
super
=
stream_stage_driver
<
int
,
downstream_manager
>
;
driver
(
downstream_manager
&
out
,
vector
<
int
>*
log
)
:
super
(
out
),
log_
(
log
)
{
// nop
// nop
}
}
...
...
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