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
b0deb598
Commit
b0deb598
authored
Mar 13, 2018
by
Dominik Charousset
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename add_{unsafe => unchecked}_(...)_path
parent
80ad81ec
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
39 additions
and
37 deletions
+39
-37
libcaf_core/caf/detail/stream_sink_impl.hpp
libcaf_core/caf/detail/stream_sink_impl.hpp
+0
-4
libcaf_core/caf/scheduled_actor.hpp
libcaf_core/caf/scheduled_actor.hpp
+1
-1
libcaf_core/caf/stream_manager.hpp
libcaf_core/caf/stream_manager.hpp
+15
-15
libcaf_core/caf/stream_sink.hpp
libcaf_core/caf/stream_sink.hpp
+7
-1
libcaf_core/caf/stream_source.hpp
libcaf_core/caf/stream_source.hpp
+4
-4
libcaf_core/src/stream_manager.cpp
libcaf_core/src/stream_manager.cpp
+8
-8
libcaf_core/test/fused_streaming.cpp
libcaf_core/test/fused_streaming.cpp
+4
-4
No files found.
libcaf_core/caf/detail/stream_sink_impl.hpp
View file @
b0deb598
...
...
@@ -56,10 +56,6 @@ public:
return
out_
;
}
bool
done
()
const
override
{
return
!
this
->
continuous
()
&&
this
->
inbound_paths_
.
empty
();
}
void
handle
(
inbound_path
*
,
downstream_msg
::
batch
&
x
)
override
{
CAF_LOG_TRACE
(
CAF_ARG
(
x
));
using
vec_type
=
std
::
vector
<
input_type
>
;
...
...
libcaf_core/caf/scheduled_actor.hpp
View file @
b0deb598
...
...
@@ -485,7 +485,7 @@ public:
std
::
move
(
fin
));
auto
tk
=
std
::
make_tuple
(
stream
<
output_type
>
{});
auto
handshake
=
make_message_from_tuple
(
std
::
tuple_cat
(
tk
,
std
::
move
(
xs
)));
auto
slot
=
mgr
->
add_un
safe
_outbound_path_impl
(
auto
slot
=
mgr
->
add_un
checked
_outbound_path_impl
(
actor_cast
<
strong_actor_ptr
>
(
dest
),
std
::
move
(
handshake
));
if
(
slot
==
invalid_stream_slot
)
{
CAF_LOG_WARNING
(
"unable to assign a slot in make_source"
);
...
...
libcaf_core/caf/stream_manager.hpp
View file @
b0deb598
...
...
@@ -152,9 +152,9 @@ public:
/// @pre `out().terminal() == false`
/// @private
template
<
class
Out
>
output_stream_t
<
Out
>
add_un
safe
_outbound_path
()
{
output_stream_t
<
Out
>
add_un
checked
_outbound_path
()
{
auto
handshake
=
make_message
(
stream
<
Out
>
{});
return
{
0
,
add_un
safe
_outbound_path_impl
(
std
::
move
(
handshake
)),
this
};
return
{
0
,
add_un
checked
_outbound_path_impl
(
std
::
move
(
handshake
)),
this
};
}
/// Creates an outbound path to the current sender without any type checking.
...
...
@@ -162,10 +162,10 @@ public:
/// @private
template
<
class
Out
,
class
...
Ts
>
output_stream_t
<
Out
,
detail
::
strip_and_convert_t
<
Ts
>
...
>
add_un
safe
_outbound_path
(
std
::
tuple
<
Ts
...
>
xs
)
{
add_un
checked
_outbound_path
(
std
::
tuple
<
Ts
...
>
xs
)
{
auto
tk
=
std
::
make_tuple
(
stream
<
Out
>
{});
auto
handshake
=
make_message_from_tuple
(
std
::
tuple_cat
(
tk
,
std
::
move
(
xs
)));
return
{
0
,
add_un
safe
_outbound_path_impl
(
std
::
move
(
handshake
)),
this
};
return
{
0
,
add_un
checked
_outbound_path_impl
(
std
::
move
(
handshake
)),
this
};
}
/// Creates an outbound path to `next`, only checking whether the interface
...
...
@@ -175,11 +175,11 @@ public:
/// @pre `out().terminal() == false`
/// @private
template
<
class
Out
,
class
Handle
>
output_stream_t
<
Out
>
add_un
safe
_outbound_path
(
Handle
next
)
{
output_stream_t
<
Out
>
add_un
checked
_outbound_path
(
Handle
next
)
{
// TODO: type checking
auto
handshake
=
make_message
(
stream
<
Out
>
{});
auto
hdl
=
actor_cast
<
strong_actor_ptr
>
(
std
::
move
(
next
));
auto
slot
=
add_un
safe
_outbound_path_impl
(
std
::
move
(
hdl
),
auto
slot
=
add_un
checked
_outbound_path_impl
(
std
::
move
(
hdl
),
std
::
move
(
handshake
));
return
{
0
,
slot
,
this
};
}
...
...
@@ -192,12 +192,12 @@ public:
/// @private
template
<
class
Out
,
class
Handle
,
class
...
Ts
>
output_stream_t
<
Out
,
detail
::
strip_and_convert_t
<
Ts
>
...
>
add_un
safe
_outbound_path
(
const
Handle
&
next
,
std
::
tuple
<
Ts
...
>
xs
)
{
add_un
checked
_outbound_path
(
const
Handle
&
next
,
std
::
tuple
<
Ts
...
>
xs
)
{
// TODO: type checking
auto
tk
=
std
::
make_tuple
(
stream
<
Out
>
{});
auto
handshake
=
make_message_from_tuple
(
std
::
tuple_cat
(
tk
,
std
::
move
(
xs
)));
auto
hdl
=
actor_cast
<
strong_actor_ptr
>
(
std
::
move
(
next
));
auto
slot
=
add_un
safe
_outbound_path_impl
(
std
::
move
(
hdl
),
auto
slot
=
add_un
checked
_outbound_path_impl
(
std
::
move
(
hdl
),
std
::
move
(
handshake
));
return
{
0
,
slot
,
this
};
}
...
...
@@ -207,27 +207,27 @@ public:
/// @pre `out().terminal() == false`
/// @private
template
<
class
In
>
stream_result
<>
add_un
safe
_inbound_path
(
const
stream
<
In
>&
)
{
return
{
add_un
safe
_inbound_path_impl
(),
this
};
stream_result
<>
add_un
checked
_inbound_path
(
const
stream
<
In
>&
)
{
return
{
add_un
checked
_inbound_path_impl
(),
this
};
}
/// Adds a new outbound path to `rp.next()`.
/// @private
stream_slot
add_un
safe
_outbound_path_impl
(
response_promise
&
rp
,
stream_slot
add_un
checked
_outbound_path_impl
(
response_promise
&
rp
,
message
handshake
);
/// Adds a new outbound path to `next`.
/// @private
stream_slot
add_un
safe
_outbound_path_impl
(
strong_actor_ptr
next
,
stream_slot
add_un
checked
_outbound_path_impl
(
strong_actor_ptr
next
,
message
handshake
);
/// Calls `add_un
safe
_outbound_path_impl(make_response_promise(), handshake)`.
/// Calls `add_un
checked
_outbound_path_impl(make_response_promise(), handshake)`.
/// @private
stream_slot
add_un
safe
_outbound_path_impl
(
message
handshake
);
stream_slot
add_un
checked
_outbound_path_impl
(
message
handshake
);
/// Adds the current sender as an inbound path.
/// @pre Current message is an `open_stream_msg`.
stream_slot
add_un
safe
_inbound_path_impl
();
stream_slot
add_un
checked
_inbound_path_impl
();
protected:
// -- modifiers for self -----------------------------------------------------
...
...
libcaf_core/caf/stream_sink.hpp
View file @
b0deb598
...
...
@@ -42,12 +42,18 @@ public:
// nop
}
// -- overridden member functions --------------------------------------------
bool
done
()
const
override
{
return
!
this
->
continuous
()
&&
this
->
inbound_paths_
.
empty
();
}
// -- properties -------------------------------------------------------------
/// Creates a new input path to the current sender.
stream_result
<
intrusive_ptr
<
stream_sink
>>
add_inbound_path
(
const
stream
<
input_type
>&
)
{
return
{
add_un
safe
_inbound_path_impl
(),
this
};
return
{
add_un
checked
_inbound_path_impl
(),
this
};
}
};
...
...
libcaf_core/caf/stream_source.hpp
View file @
b0deb598
...
...
@@ -51,7 +51,7 @@ public:
output_stream
<
Out
,
std
::
tuple
<>
,
intrusive_ptr
<
stream_source
>>
add_outbound_path
()
{
CAF_LOG_TRACE
(
""
);
return
this
->
add_un
safe
_outbound_path
<
Out
>
().
rebind
(
this
);
return
this
->
add_un
checked
_outbound_path
<
Out
>
().
rebind
(
this
);
}
/// Creates a new output path to the current sender with custom handshake.
...
...
@@ -60,7 +60,7 @@ public:
intrusive_ptr
<
stream_source
>>
add_outbound_path
(
std
::
tuple
<
Ts
...
>
xs
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
xs
));
return
this
->
add_un
safe
_outbound_path
<
Out
>
(
std
::
move
(
xs
)).
rebind
(
this
);
return
this
->
add_un
checked
_outbound_path
<
Out
>
(
std
::
move
(
xs
)).
rebind
(
this
);
}
/// Creates a new output path to the current sender.
...
...
@@ -68,7 +68,7 @@ public:
output_stream
<
Out
,
std
::
tuple
<>
,
intrusive_ptr
<
stream_source
>>
add_outbound_path
(
const
Handle
&
next
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
next
));
return
this
->
add_un
safe
_outbound_path
<
Out
>
(
next
).
rebind
(
this
);
return
this
->
add_un
checked
_outbound_path
<
Out
>
(
next
).
rebind
(
this
);
}
/// Creates a new output path to the current sender with custom handshake.
...
...
@@ -77,7 +77,7 @@ public:
intrusive_ptr
<
stream_source
>>
add_outbound_path
(
const
Handle
&
next
,
std
::
tuple
<
Ts
...
>
xs
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
next
)
<<
CAF_ARG
(
xs
));
return
this
->
add_un
safe
_outbound_path
<
Out
>
(
next
,
std
::
move
(
xs
))
return
this
->
add_un
checked
_outbound_path
<
Out
>
(
next
,
std
::
move
(
xs
))
.
rebind
(
this
);
}
...
...
libcaf_core/src/stream_manager.cpp
View file @
b0deb598
...
...
@@ -176,7 +176,7 @@ void stream_manager::remove_input_path(stream_slot slot, error reason,
self_
->
erase_inbound_path_later
(
slot
,
std
::
move
(
reason
));
}
stream_slot
stream_manager
::
add_un
safe
_outbound_path_impl
(
response_promise
&
rp
,
stream_slot
stream_manager
::
add_un
checked
_outbound_path_impl
(
response_promise
&
rp
,
message
handshake
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
rp
)
<<
CAF_ARG
(
handshake
));
CAF_ASSERT
(
out
().
terminal
()
==
false
);
...
...
@@ -195,31 +195,31 @@ stream_slot stream_manager::add_unsafe_outbound_path_impl(response_promise& rp,
return
slot
;
}
stream_slot
stream_manager
::
add_un
safe
_outbound_path_impl
(
strong_actor_ptr
next
,
stream_slot
stream_manager
::
add_un
checked
_outbound_path_impl
(
strong_actor_ptr
next
,
message
handshake
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
next
)
<<
CAF_ARG
(
handshake
));
response_promise
rp
{
self_
->
ctrl
(),
nullptr
,
{
next
},
make_message_id
()};
return
add_un
safe
_outbound_path_impl
(
rp
,
std
::
move
(
handshake
));
return
add_un
checked
_outbound_path_impl
(
rp
,
std
::
move
(
handshake
));
}
stream_slot
stream_manager
::
add_un
safe
_outbound_path_impl
(
message
handshake
)
{
stream_slot
stream_manager
::
add_un
checked
_outbound_path_impl
(
message
handshake
)
{
CAF_LOG_TRACE
(
CAF_ARG
(
handshake
));
auto
rp
=
self_
->
make_response_promise
();
return
add_un
safe
_outbound_path_impl
(
rp
,
std
::
move
(
handshake
));
return
add_un
checked
_outbound_path_impl
(
rp
,
std
::
move
(
handshake
));
}
stream_slot
stream_manager
::
add_un
safe
_inbound_path_impl
()
{
stream_slot
stream_manager
::
add_un
checked
_inbound_path_impl
()
{
CAF_LOG_TRACE
(
""
);
auto
x
=
self_
->
current_mailbox_element
();
if
(
x
==
nullptr
||
!
x
->
content
().
match_elements
<
open_stream_msg
>
())
{
CAF_LOG_ERROR
(
"add_un
safe
_inbound_path called, but current message "
CAF_LOG_ERROR
(
"add_un
checked
_inbound_path called, but current message "
"is not an open_stream_msg"
);
return
invalid_stream_slot
;
}
auto
&
osm
=
x
->
content
().
get_mutable_as
<
open_stream_msg
>
(
0
);
if
(
out
().
terminal
()
&&
!
self_
->
current_forwarding_stack
().
empty
())
{
// Sinks must always terminate the stream.
CAF_LOG_WARNING
(
"add_un
safe
_inbound_path called in a sink, but the "
CAF_LOG_WARNING
(
"add_un
checked
_inbound_path called in a sink, but the "
"handshake has further stages"
);
stream_slots
path_id
{
osm
.
slot
,
0
};
auto
code
=
sec
::
cannot_add_downstream
;
...
...
libcaf_core/test/fused_streaming.cpp
View file @
b0deb598
...
...
@@ -225,24 +225,24 @@ TESTEE(stream_multiplexer) {
[
=
](
join_atom
,
ints_atom
)
{
auto
&
stg
=
self
->
state
.
stage
;
CAF_MESSAGE
(
"received 'join' request for integers"
);
auto
result
=
stg
->
add_un
safe
_outbound_path
<
int
>
();
auto
result
=
stg
->
add_un
checked
_outbound_path
<
int
>
();
stg
->
out
().
assign
<
int_scatterer
>
(
result
.
out
());
return
result
;
},
[
=
](
join_atom
,
strings_atom
)
{
auto
&
stg
=
self
->
state
.
stage
;
CAF_MESSAGE
(
"received 'join' request for strings"
);
auto
result
=
stg
->
add_un
safe
_outbound_path
<
string
>
();
auto
result
=
stg
->
add_un
checked
_outbound_path
<
string
>
();
stg
->
out
().
assign
<
string_scatterer
>
(
result
.
out
());
return
result
;
},
[
=
](
const
stream
<
int
>&
in
)
{
CAF_MESSAGE
(
"received handshake for integers"
);
return
self
->
state
.
stage
->
add_un
safe
_inbound_path
(
in
);
return
self
->
state
.
stage
->
add_un
checked
_inbound_path
(
in
);
},
[
=
](
const
stream
<
string
>&
in
)
{
CAF_MESSAGE
(
"received handshake for strings"
);
return
self
->
state
.
stage
->
add_un
safe
_inbound_path
(
in
);
return
self
->
state
.
stage
->
add_un
checked
_inbound_path
(
in
);
}
};
}
...
...
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