nvflare.fuel.f3.drivers.driver module

class ConnMonitor[source]

Bases: ABC

abstract state_change(connection: Connection)[source]

Driver state change notification, including new connections

Parameters:

connection – The connection that state has changed

Raises:

CommError – If any error happens while processing the frame

class Driver[source]

Bases: ABC

Transport driver spec A transport driver is responsible for establishing connections. The connections are used to transport frames to remote endpoint.

The frame is opaque to the driver, except the length (first 4-bytes), which may be needed to determine the frame boundary on stream-based transports like TCP or sockets.

abstract static capabilities() Dict[str, Any][source]

Return a dictionary of capabilities of the driver.

abstract connect(connector: ConnectorInfo)[source]

Start the driver in active mode

Parameters:

connector – Connector with parameters

Raises:

CommError – If any errors

get_name() str[source]

Return the name of the driver, used for logging By default, it returns class name

abstract static get_urls(scheme: str, resources: dict) -> (<class 'str'>, <class 'str'>)[source]

Get active and passive URL pair based on resources

Parameters:
  • scheme – A scheme supported by the driver, like http or https

  • resources – User specified resources like host and port ranges.

Returns:

A tuple with active and passive URLs

Raises:

CommError – If no free port can be found

abstract listen(connector: ConnectorInfo)[source]

Start the driver in passive mode

Parameters:

connector – Connector with parameters

Raises:

CommError – If any errors

register_conn_monitor(monitor: ConnMonitor)[source]

Register a monitor for connection state change, including new connections

abstract shutdown()[source]

Stop driver and disconnect all the connections created by it

Raises:

CommError – If any errors

abstract static supported_transports() List[str][source]

Return a list of transports supported by this driver, for example [“http”, “https”, “ws”, “wss”]