rsb.transport¶
This module contains different transport implementations for RSB and their common base classes and utility functions.
Code author: jmoringe
Code author: jwienke
Functions
getTransportFactory (name) |
Returns a TransportFactory instance for the transport with the given name. |
registerTransport (factory) |
Registers a new transport. |
Classes
Connector ([wireType]) |
Superclass for transport-specific connector classes. |
ConverterSelectingConnector (converters, **kwargs) |
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. |
InPullConnector ([wireType]) |
Superclass for connectors that receive events using a pull style. |
InPushConnector ([wireType]) |
Superclass for in-direction (that is, dealing with incoming events) connector implementations. |
OutConnector ([wireType]) |
Superclass for out-direction (that is, dealing with outgoing events) connector implementations. |
TransportFactory |
Interface for factories which are able to create Connector instances for a certain transport. |
-
class
rsb.transport.
Connector
(wireType=None, **kwargs)¶ Bases:
object
Superclass for transport-specific connector classes.
Code author: jwienke
Creates a new connector with a serialization type wireType.
Parameters: wireType (types.TypeType) – the type of serialized data used by this connector. -
activate
()¶
-
deactivate
()¶
-
getScope
()¶
-
getWireType
()¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
setQualityOfServiceSpec
(qos)¶
-
setScope
(newValue)¶ Sets the scope this connector will receive events from to
newValue
. Called before #activate.Parameters: newValue (rsb.Scope) – scope of the connector
-
scope
¶
-
wireType
¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
-
class
rsb.transport.
ConverterSelectingConnector
(converters, **kwargs)¶ Bases:
object
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
Creates a new connector that uses the converters in
converters
to deserialize notification and/or serialize events.Parameters: converters (rsb.converter.ConverterSelectionStrategy) – 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.-
getConverterForDataType
(dataType)¶ Returns a converter that can convert the supplied data to the wire-type.
Parameters: dataType – the type of the object for which a suitable converter should returned. Returns: converter Raises: KeyError
– no converter is available for the supplied data.
-
getConverterForWireSchema
(wireSchema)¶ Returns a suitable converter for the
wireSchema
.Parameters: wireSchema (str) – the wire-schema to or from which the returned converter should convert Returns: converter Raises: KeyError
– no converter is available for the specified wire-schema.
-
getConverterMap
()¶
-
converterMap
¶
-
-
class
rsb.transport.
InPullConnector
(wireType=None, **kwargs)¶ Bases:
rsb.transport.Connector
Superclass for connectors that receive events using a pull style.
Code author: jwienke
Creates a new connector with a serialization type wireType.
Parameters: wireType (types.TypeType) – the type of serialized data used by this connector. -
activate
()¶
-
deactivate
()¶
-
getScope
()¶
-
getWireType
()¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
raiseEvent
(block)¶ Returns the next received event.
Parameters: block (bool) – If True
, wait for the next event, else immediately return, possiblyNone
.Returns: - rsb.Event or
None
- The next event or
None
ifblock
isFalse
.
- rsb.Event or
-
setQualityOfServiceSpec
(qos)¶
-
setScope
(newValue)¶ Sets the scope this connector will receive events from to
newValue
. Called before #activate.Parameters: newValue (rsb.Scope) – scope of the connector
-
scope
¶
-
wireType
¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
-
class
rsb.transport.
InPushConnector
(wireType=None, **kwargs)¶ Bases:
rsb.transport.Connector
Superclass for in-direction (that is, dealing with incoming events) connector implementations.
Code author: jmoringe
Creates a new connector with a serialization type wireType.
Parameters: wireType (types.TypeType) – the type of serialized data used by this connector. -
activate
()¶
-
deactivate
()¶
-
filterNotify
(filter, action)¶
-
getScope
()¶
-
getWireType
()¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
setObserverAction
(action)¶ Sets 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.
-
setQualityOfServiceSpec
(qos)¶
-
setScope
(newValue)¶ Sets the scope this connector will receive events from to
newValue
. Called before #activate.Parameters: newValue (rsb.Scope) – scope of the connector
-
scope
¶
-
wireType
¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
-
class
rsb.transport.
OutConnector
(wireType=None, **kwargs)¶ Bases:
rsb.transport.Connector
Superclass for out-direction (that is, dealing with outgoing events) connector implementations.
Code author: jmoringe
Creates a new connector with a serialization type wireType.
Parameters: wireType (types.TypeType) – the type of serialized data used by this connector. -
activate
()¶
-
deactivate
()¶
-
getScope
()¶
-
getWireType
()¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
handle
(event)¶ Sends
event
and adapts its meta data instance with the actual send time.Parameters: event – event to send
-
setQualityOfServiceSpec
(qos)¶
-
setScope
(newValue)¶ Sets the scope this connector will receive events from to
newValue
. Called before #activate.Parameters: newValue (rsb.Scope) – scope of the connector
-
scope
¶
-
wireType
¶ Returns the serialization type used for this connector.
Returns: python serialization type
-
-
class
rsb.transport.
TransportFactory
¶ Bases:
object
Interface for factories which are able to create
Connector
instances for a certain transport.-
createInPullConnector
(converters, options)¶ Creates a new instance of an
InPullConnector
for the represented transport.Parameters: - converters (ConverterSelectionStrategy) – the converters to use for this type
- options (dict of str) – options for the new connector
Returns: the new connector instance
Return type:
-
createInPushConnector
(converters, options)¶ Creates a new instance of an
InPushConnector
for the represented transport.Parameters: converters (ConverterSelectionStrategy) – the converters to use for this type options(dict of str): options for the new connector Returns: the new connector instance Return type: rsb.transport.InPushConnector
-
createOutConnector
(converters, options)¶ Creates a new instance of an
OutConnector
for the represented transport.Parameters: converters (ConverterSelectionStrategy) – the converters to use for this type options(dict of str): options for the new connector Returns: the new connector instance Return type: rsb.transport.OutConnector
-
-
rsb.transport.
getTransportFactory
(name)¶ Returns a
TransportFactory
instance for the transport with the given name.Parameters: name (str) – name of the transport Returns: the TransportFactory
instanceReturn type: rsb.transport.TransportFactory Raises: KeyError
– there is not transport with the given name
-
rsb.transport.
registerTransport
(factory)¶ Registers a new transport.
Parameters: factory (rsb.transport.TransportFactory) – the factory for the transport Raises: ValueError
– there is already a transport registered with this name or the given factory argument is invalid