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
229f4935
Commit
229f4935
authored
May 09, 2017
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Check content of storages in manual_stream test
parent
7c77a514
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
4 deletions
+22
-4
libcaf_core/test/manual_stream_management.cpp
libcaf_core/test/manual_stream_management.cpp
+22
-4
No files found.
libcaf_core/test/manual_stream_management.cpp
View file @
229f4935
...
@@ -196,10 +196,10 @@ struct core_state {
...
@@ -196,10 +196,10 @@ struct core_state {
void
init
(
event_based_actor
*
s
,
filter_type
initial_filter
)
{
void
init
(
event_based_actor
*
s
,
filter_type
initial_filter
)
{
self
=
s
;
self
=
s
;
filter
=
std
::
move
(
initial_filter
);
filter
=
std
::
move
(
initial_filter
);
governor
=
make_counted
<
stream_governor
>
(
this
);
sid
=
sid
=
stream_id
{
self
->
ctrl
(),
stream_id
{
self
->
ctrl
(),
self
->
new_request_id
(
message_priority
::
normal
).
integer_value
()};
self
->
new_request_id
(
message_priority
::
normal
).
integer_value
()};
governor
=
make_counted
<
stream_governor
>
(
this
);
self
->
streams
().
emplace
(
sid
,
governor
);
self
->
streams
().
emplace
(
sid
,
governor
);
}
}
...
@@ -558,7 +558,12 @@ void driver(event_based_actor* self, const actor& sink) {
...
@@ -558,7 +558,12 @@ void driver(event_based_actor* self, const actor& sink) {
);
);
}
}
void
consumer
(
event_based_actor
*
self
,
filter_type
ts
,
const
actor
&
src
)
{
struct
consumer_state
{
std
::
vector
<
element_type
>
xs
;
};
void
consumer
(
stateful_actor
<
consumer_state
>*
self
,
filter_type
ts
,
const
actor
&
src
)
{
self
->
send
(
self
*
src
,
join_atom
::
value
,
std
::
move
(
ts
));
self
->
send
(
self
*
src
,
join_atom
::
value
,
std
::
move
(
ts
));
self
->
become
(
self
->
become
(
[
=
](
const
stream_type
&
in
)
{
[
=
](
const
stream_type
&
in
)
{
...
@@ -570,14 +575,17 @@ void consumer(event_based_actor* self, filter_type ts, const actor& src) {
...
@@ -570,14 +575,17 @@ void consumer(event_based_actor* self, filter_type ts, const actor& src) {
// nop
// nop
},
},
// Process single element.
// Process single element.
[
](
unit_t
&
,
element_type
)
{
[
=
](
unit_t
&
,
element_type
x
)
{
// nop
self
->
state
.
xs
.
emplace_back
(
std
::
move
(
x
));
},
},
// Cleanup.
// Cleanup.
[](
unit_t
&
)
{
[](
unit_t
&
)
{
// nop
// nop
}
}
);
);
},
[
=
](
get_atom
)
{
return
self
->
state
.
xs
;
}
}
);
);
}
}
...
@@ -644,6 +652,16 @@ CAF_TEST(two_peers) {
...
@@ -644,6 +652,16 @@ CAF_TEST(two_peers) {
.
with
(
2
,
buf
{{
"b"
,
0
},
{
"b"
,
1
}},
0
));
.
with
(
2
,
buf
{{
"b"
,
0
},
{
"b"
,
1
}},
0
));
expect
((
stream_msg
::
ack_batch
),
from
(
core2
).
to
(
core1
).
with
(
5
,
0
));
expect
((
stream_msg
::
ack_batch
),
from
(
core2
).
to
(
core1
).
with
(
5
,
0
));
expect
((
stream_msg
::
ack_batch
),
from
(
core1
).
to
(
d1
).
with
(
5
,
0
));
expect
((
stream_msg
::
ack_batch
),
from
(
core1
).
to
(
d1
).
with
(
5
,
0
));
// Check log of the consumer.
self
->
send
(
leaf
,
get_atom
::
value
);
sched
.
prioritize
(
leaf
);
sched
.
run_once
();
self
->
receive
(
[](
const
buf
&
xs
)
{
buf
expected
{{
"b"
,
0
},
{
"b"
,
1
}};
CAF_REQUIRE_EQUAL
(
xs
,
expected
);
}
);
// Shutdown.
// Shutdown.
CAF_MESSAGE
(
"Shutdown core actors."
);
CAF_MESSAGE
(
"Shutdown core actors."
);
anon_send_exit
(
core1
,
exit_reason
::
user_shutdown
);
anon_send_exit
(
core1
,
exit_reason
::
user_shutdown
);
...
...
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