Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updated dataflow semantics ConnPolicy #118

Merged

Conversation

meyerj
Copy link
Member

@meyerj meyerj commented Oct 27, 2015

This pull request is part of a bigger effort to add support for new connection semantics to RTT (see #114).

The new fields added to the ConnPolicy struct are:

  • read_policy (of enum type ReadPolicy)
  • write_policy (of enum type WritePolicy)
  • mandatory (of type bool)
  • max_threads (of type int).

We also added a global ConnPolicy instance which serves as a template for new default-constructed instances. It can be accessed from scripting through the GlobalsRepository as DefaultConnPolicy.

Please check the source code documentation in ConnPolicy.hpp or the design document for more details.

@meyerj meyerj added this to the 2.9 milestone Oct 27, 2015
@meyerj
Copy link
Member Author

meyerj commented Nov 13, 2015

In the meantime we had some discussions about the naming of the new policy fields and the corresponding constants. Even during internal discussions the current naming scheme leads to some confusion, especially because it is not clear to the user what exactly is shared in a ReadShared (multiple writers write to the same input buffer) or WriteShared connection (multiple readers read from the same output buffer).

We therefore consider to unify the read_policy and write_policy fields into a single field called the buffer_policy with four possible values:

  • PerConnection <==> (read_policy == ReadUnordered) && (write_policy == WritePrivate)
    Buffers (or data objects) will be installed per connection (per pair of output and input port/stream). Input ports with multiple connections first try to read from the last read channel first, then poll all connections in the order they have been made (which in practice means there are no guarantees on the order if multiple writers write concurrently). This is the old and new default buffer policy.
  • PerInputPort <==> (read_policy == ReadShared) && (write_policy == WritePrivate)
    Every input port has a single input buffer (or data object) and all connected output ports/streams will write to the same buffer. This policy requires that pull == false for remote connections or input streams.
  • PerOutputPort <==> (read_policy == ReadUnordered) && (write_policy == WriteShared)
    Every output has a single output buffer (or data object) and all connected readers "consume" elements from this buffer. Exactly one connected input port or output stream will see every written sample as NewData. This policy requires that pull == true for remote connections or output streams.
  • Shared <==> (read_policy == ReadShared) && (write_policy == WriteShared)
    The buffer (or data object) is shared between all connected input and output ports. It can have an arbitrary number of writers and readers. Ports can be connected to an existing shared connection instance either by connecting it to a port that is already part of the shared connection group, or with a special createConnection() method. This was the default buffer policy in the days of RTT v1.

What do you think?

@doudou
Copy link
Contributor

doudou commented Nov 13, 2015

👍 looks less confusing indeed.

@psoetens
Copy link
Member

👍

1 similar comment
@smits
Copy link
Member

smits commented Nov 19, 2015

👍

meyerj added a commit that referenced this pull request Dec 15, 2015
See #118 (comment).

Signed-off-by: Johannes Meyer <johannes@intermodalics.eu>
meyerj added a commit to meyerj/rtt that referenced this pull request Dec 21, 2015
See orocos-toolchain#118 (comment).

Signed-off-by: Johannes Meyer <johannes@intermodalics.eu>

Conflicts:
	rtt/transports/corba/CorbaConnPolicy.cpp
meyerj added a commit to meyerj/rtt that referenced this pull request Dec 21, 2015
See orocos-toolchain#118 (comment).

Signed-off-by: Johannes Meyer <johannes@intermodalics.eu>
meyerj added a commit to meyerj/rtt that referenced this pull request Dec 21, 2015
See orocos-toolchain#118 (comment).

Signed-off-by: Johannes Meyer <johannes@intermodalics.eu>

Conflicts:
	rtt/transports/corba/CorbaConnPolicy.cpp
meyerj added a commit to meyerj/rtt that referenced this pull request Dec 21, 2015
See orocos-toolchain#118 (comment).

Signed-off-by: Johannes Meyer <johannes@intermodalics.eu>

Conflicts:
	rtt/transports/corba/CorbaConnPolicy.cpp
meyerj added a commit to meyerj/rtt that referenced this pull request Oct 16, 2017
See orocos-toolchain#118 (comment).

Signed-off-by: Johannes Meyer <johannes@intermodalics.eu>

Conflicts:
	rtt/transports/corba/CorbaConnPolicy.cpp
meyerj added a commit to meyerj/rtt that referenced this pull request Oct 17, 2017
See orocos-toolchain#118 (comment).

Signed-off-by: Johannes Meyer <johannes@intermodalics.eu>

Conflicts:
	rtt/transports/corba/CorbaConnPolicy.cpp
@meyerj meyerj merged commit 204bb12 into orocos-toolchain:master May 8, 2019
@meyerj meyerj deleted the updated-dataflow-semantics-connpolicy branch May 8, 2019 23:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants