Mercury2 Hardware Manager  1.0dev
The hardware manager component of the Mercury2 ground station suite.
 All Classes Namespaces Functions Variables Pages
hwm.network.protocols.data.PipelineData Class Reference

Represents a Pipeline data connection. More...

Inheritance diagram for hwm.network.protocols.data.PipelineData:

Public Member Functions

def __init__
 Sets up the PipelineData protocol instance. More...
 
def write_output
 Sends a chunk of pipeline output to the user. More...
 
def dataReceived
 Receives data that the user is trying to write to the pipeline. More...
 
def connectionMade
 Sets up the data protocol before any data transfer occurs. More...
 
def connectionLost
 Called when the pipeline data connection is lost.
 
def perform_registrations
 Performs the necessary registrations between the protocol and its associated session. More...
 

Public Attributes

 session_coordinator
 
 session
 

Private Member Functions

def _connection_setup_error
 Handles errors that arise during the data protocol connection setup. More...
 

Detailed Description

Represents a Pipeline data connection.

This Protocol represents a Pipeline data stream connection to the pipeline's active user (through its currently active session). It is responsible for sending the pipeline's output to the end user as well as passing the user's input to the pipeline. It uses a basic TCP protocol.

Note
This Protocol only routes the pipeline data stream (what "flows" in and out of the pipeline). All other data, such as the pipeline telemetry stream and station commands, pass through different protocols.

Constructor & Destructor Documentation

def hwm.network.protocols.data.PipelineData.__init__ (   self,
  session_coordinator 
)

Sets up the PipelineData protocol instance.

Parameters
session_coordinatorA SessionCoordinator instance that will be used to locate requested sessions.

Member Function Documentation

def hwm.network.protocols.data.PipelineData._connection_setup_error (   self,
  failure 
)
private

Handles errors that arise during the data protocol connection setup.

 This callback handles errors that may occur when authenticating the protocol user and loading their requested
 session. It logs the error and cleans up the protocol's connection.
Parameters
failureA Failure object encapsulating the error.
Returns
Returns None after handling the error.
def hwm.network.protocols.data.PipelineData.connectionMade (   self)

Sets up the data protocol before any data transfer occurs.

 This method sets up the protocol right after the connection has been established. It is responsible for calling a
 function that will wait and load the user's certificate after the TLS handshake has been performed.
Note
Because this method may be (and probably will be) called before the connection's TLS handshake is complete, it calls an additional function that periodically checks if the client's certificate is available and, once it is, returns it via a deferred. Any data that the user tries to pass to the connection before the TLS handshake has completed will be dropped.
Returns
Returns a deferred that will be fired with the requested Session.
def hwm.network.protocols.data.PipelineData.dataReceived (   self,
  data 
)

Receives data that the user is trying to write to the pipeline.

 This method receives data from the pipeline user and passes it along to the target pipeline via the associated
 session.
Note
If the session specified in the user's SSL certificate is not yet active, any data that they send will be discarded until the session is made active active.
Parameters
dataA chunk of data of indeterminate size that is to be passed to the session.
def hwm.network.protocols.data.PipelineData.perform_registrations (   self,
  requested_session 
)

Performs the necessary registrations between the protocol and its associated session.

 This callback makes the necessary registrations between the pipeline data protocol and its Session. It will be 
 called with session specified in the client's TLS certificate after the TLS handshake is complete.
Exceptions
Maypass along session.ProtocolAlreadyRegistered exceptions when trying to register this protocol with its session.
Parameters
requested_sessionThe Session associated with the protocol.
Returns
Returns the newly loaded Session that was passed to this callback.
def hwm.network.protocols.data.PipelineData.write_output (   self,
  output_data 
)

Sends a chunk of pipeline output to the user.

 This method writes the provided chunk of data (output from the pipeline) to the end user.
Note
Because all pipeline output must reach the end user, any data received by this function is passed to the transport regardless of the buffer state. All data in the transport's buffer will eventually be sent to the pipeline user (unless the connection is lost).
See Also
https://twistedmatrix.com/documents/8.1.0/api/twisted.internet.interfaces.ITransport.html#write
Parameters
output_dataA chunk of pipeline output of arbitrary size that is to be sent to the pipeline user.

The documentation for this class was generated from the following file: