rsb.transport¶
Contains the interface and bases classes for implementing RSB transports.
Code author: jmoringe
Code author: jwienke
Functions
|
Return a |
|
Register a new transport. |
Classes
|
Superclass for transport-specific connector classes. |
|
Base class for connectors that use a map of converters for serialization. |
|
Superclass for in-direction connectors that use asynchronous notification. |
|
Superclass for connectors sending events to the outside world. |
Creates connectors for a specific transport. |
-
class
rsb.transport.
Connector
(wire_type=None, **kwargs)¶ Bases:
object
Superclass for transport-specific connector classes.
Code author: jwienke
Create a new connector with a serialization type wire_type.
- Parameters
wire_type – the type of serialized data used by this connector.
- Type wire_type
types.TypeType
-
abstract
activate
()¶
-
abstract
deactivate
()¶
-
abstract
set_quality_of_service_spec
(qos)¶
-
property
scope
¶
-
property
wire_type
¶ Return the serialization type used for this connector.
- Returns
python serialization type
-
class
rsb.transport.
ConverterSelectingConnector
(converters, **kwargs)¶ Bases:
object
Base class for connectors that use a map of converters for serialization.
This class is intended to be used a superclass (or rather mixin class) for connector classes which have to store a map of converters and select converters for (de)serialization.
Code author: jmoringe
Create a new connector with the specified converters.
The new converter uses the converters in
converters
to deserialize notification and/or serialize events.- Parameters
converters – The converter selection strategy that should be used by the connector. If
None
, the global map of converters for the wire-type of the connector is used.- Type converters
rsb.converter.ConverterSelectionStrategy
-
get_converter_for_data_type
(data_type)¶ Return a converter that converts the supplied data to the wire-type.
- Parameters
data_type – the type of the object for which a suitable converter should returned.
- Returns
converter
- Raises KeyError
no converter is available for the supplied data.
-
get_converter_for_wire_schema
(wire_schema)¶ Return a suitable converter for the
wire_schema
.- Parameters
wire_schema – the wire-schema to or from which the returned converter should convert
- Type wire_schema
str
- Returns
converter
- Raises KeyError
no converter is available for the specified wire-schema.
-
property
converter_map
¶
-
class
rsb.transport.
InConnector
(wire_type=None, **kwargs)¶ Bases:
rsb.transport.Connector
Superclass for in-direction connectors that use asynchronous notification.
Code author: jmoringe
Create a new connector with a serialization type wire_type.
- Parameters
wire_type – the type of serialized data used by this connector.
- Type wire_type
types.TypeType
-
abstract
activate
()¶
-
abstract
deactivate
()¶
-
abstract
filter_notify
(filter_, action)¶
-
abstract
set_observer_action
(action)¶ Set the action used by the connector to notify about incoming events.
The call to this method must be thread-safe.
- Parameters
action – action called if a new message is received from the connector. Must accept an
Event
as parameter.
-
abstract
set_quality_of_service_spec
(qos)¶
-
property
scope
¶
-
property
wire_type
¶ Return the serialization type used for this connector.
- Returns
python serialization type
-
class
rsb.transport.
OutConnector
(wire_type=None, **kwargs)¶ Bases:
rsb.transport.Connector
Superclass for connectors sending events to the outside world.
Code author: jmoringe
Create a new connector with a serialization type wire_type.
- Parameters
wire_type – the type of serialized data used by this connector.
- Type wire_type
types.TypeType
-
abstract
activate
()¶
-
abstract
deactivate
()¶
-
abstract
handle
(event)¶ Send
event
and adapts its meta data with the actual send time.- Parameters
event – event to send
-
abstract
set_quality_of_service_spec
(qos)¶
-
property
scope
¶
-
property
wire_type
¶ Return the serialization type used for this connector.
- Returns
python serialization type
-
class
rsb.transport.
TransportFactory
¶ Bases:
object
Creates connectors for a specific transport.
-
abstract
create_in_connector
(converters, options)¶ Create a new
InConnector
for the represented transport.- Parameters
converters – the converters to use for this type options(dict of str): options for the new connector
- Type converters
ConverterSelectionStrategy
- Returns
the new connector instance
- Rtype
rsb.transport.InConnector
-
abstract
create_out_connector
(converters, options)¶ Create a new
OutConnector
for the represented transport.- Parameters
converters – the converters to use for this type options(dict of str): options for the new connector
- Type converters
ConverterSelectionStrategy
- Returns
the new connector instance
- Rtype
rsb.transport.OutConnector
-
abstract property
name
¶ Return the name representing this transport.
- Returns
name of the transport, non-empty
- Rtype
str
-
abstract property
remote
¶ Return
true
if the transport performs remote communication.- Returns
does the transport perform remote communication?
- Rtype
bool
-
abstract
-
rsb.transport.
get_transport_factory
(name)¶ Return a
TransportFactory
for the transport with the given name.- Parameters
name – name of the transport
- Type name
str
- Returns
the
TransportFactory
instance- Rtype
rsb.transport.TransportFactory
- Raises KeyError
there is not transport with the given name
-
rsb.transport.
register_transport
(factory)¶ Register a new transport.
- Parameters
factory – the factory for the transport
- Type factory
rsb.transport.TransportFactory
- Raises ValueError
there is already a transport registered with this name or the given factory argument is invalid