dataflow.server_management.protocols¶

Protocol definitions for server management interfaces.

This module defines the protocols (interfaces) that server managers should implement, enabling type checking and ensuring consistent API across implementations.

Classes¶

ConfigLoaderProtocol

Protocol for configuration loading capabilities.

HealthMonitorProtocol

Protocol for health monitoring capabilities.

MetricsProtocol

Protocol for metrics collection capabilities.

ServerDiscoveryProtocol

Protocol for server discovery capabilities.

ServerManagerProtocol

Protocol defining the server manager interface.

Module Contents¶

class dataflow.server_management.protocols.ConfigLoaderProtocol¶

Bases: Protocol

Protocol for configuration loading capabilities.

async load_configs_from_file(path)¶

Load server configurations from a file.

Parameters:

path (str)

Return type:

Dict[str, dataflow.server_management.models.BaseServerConfig]

async save_configs_to_file(path)¶

Save current configurations to a file.

Parameters:

path (str)

Return type:

None

class dataflow.server_management.protocols.HealthMonitorProtocol¶

Bases: Protocol

Protocol for health monitoring capabilities.

async start_health_monitoring(name)¶

Start health monitoring for a server.

Parameters:

name (str)

Return type:

None

async stop_health_monitoring(name)¶

Stop health monitoring for a server.

Parameters:

name (str)

Return type:

None

class dataflow.server_management.protocols.MetricsProtocol¶

Bases: Protocol

Protocol for metrics collection capabilities.

async export_metrics(exporter)¶

Export metrics to external system.

Parameters:

exporter (str)

Return type:

None

get_aggregate_metrics()¶

Get aggregated metrics for all servers.

Return type:

Dict[str, float]

get_server_metrics(name)¶

Get metrics for a specific server.

Parameters:

name (str)

Return type:

Dict[str, float]

class dataflow.server_management.protocols.ServerDiscoveryProtocol¶

Bases: Protocol

Protocol for server discovery capabilities.

async adopt_server(server_info)¶

Adopt an externally started server.

Parameters:

server_info (dataflow.server_management.models.BaseServerInfo)

Return type:

bool

async discover_servers()¶

Discover running servers not managed by this instance.

Return type:

List[dataflow.server_management.models.BaseServerInfo]

class dataflow.server_management.protocols.ServerManagerProtocol¶

Bases: Protocol

Protocol defining the server manager interface.

This protocol ensures all server managers implement the required methods for managing server lifecycles, regardless of the specific server type.

add_config(name, config)¶

Add or update a server configuration.

Parameters:
Return type:

dataflow.server_management.models.BaseServerConfig

async cleanup()¶

Clean up resources and stop all servers.

Return type:

None

get_config(name)¶

Get server configuration by name.

Parameters:

name (str)

Return type:

Optional[dataflow.server_management.models.BaseServerConfig]

get_server_info(name)¶

Get runtime information for a server.

Parameters:

name (str)

Return type:

Optional[dataflow.server_management.models.BaseServerInfo]

get_stats()¶

Get server manager statistics.

Return type:

Dict[str, Any]

abstractmethod health_check(name)¶
Async:

Parameters:

name (str)

Return type:

bool

Check if server is healthy.

is_running(name)¶

Check if server is running.

Parameters:

name (str)

Return type:

bool

list_servers(status=None)¶

List servers by status.

Parameters:

status (Optional[dataflow.server_management.models.ServerStatus])

Return type:

List[str]

remove_config(name)¶

Remove a server configuration.

Parameters:

name (str)

Return type:

bool

abstractmethod restart_server(name)¶
Async:

Parameters:

name (str)

Return type:

dataflow.server_management.models.BaseServerInfo

Restart a server.

abstractmethod start_server(name, config=None)¶
Async:

Parameters:
Return type:

dataflow.server_management.models.BaseServerInfo

Start a server with given configuration.

abstractmethod stop_server(name, force=False)¶
Async:

Parameters:
Return type:

bool

Stop a running server.