Bases: Generic[UserT]
Manages active connections with authenticated clients.
Warning
This class is intended for internal use by the
RelayServer
.
Source code in proxystore/p2p/relay/manager.py
| def __init__(self) -> None:
self._clients_by_uuid: dict[uuid.UUID, Client[UserT]] = {}
self._clients_by_websocket: dict[
WebSocketServerProtocol,
Client[UserT],
] = {}
|
add_client()
add_client(client: Client[UserT]) -> None
Add a new authenticated client.
Source code in proxystore/p2p/relay/manager.py
| def add_client(self, client: Client[UserT]) -> None:
"""Add a new authenticated client."""
self._clients_by_uuid[client.uuid] = client
self._clients_by_websocket[client.websocket] = client
|
get_clients()
get_clients() -> list[Client[UserT]]
Get a list of all clients.
Source code in proxystore/p2p/relay/manager.py
| def get_clients(self) -> list[Client[UserT]]:
"""Get a list of all clients."""
return list(self._clients_by_uuid.values())
|
get_client_by_uuid()
get_client_by_uuid(uuid: uuid.UUID) -> Client[UserT] | None
Get a client by the client's UUID.
Source code in proxystore/p2p/relay/manager.py
| def get_client_by_uuid(self, uuid: uuid.UUID) -> Client[UserT] | None:
"""Get a client by the client's UUID."""
return self._clients_by_uuid.get(uuid, None)
|
get_client_by_websocket()
get_client_by_websocket(
websocket: WebSocketServerProtocol,
) -> Client[UserT] | None
Get a client by the current websocket connection.
Source code in proxystore/p2p/relay/manager.py
| def get_client_by_websocket(
self,
websocket: WebSocketServerProtocol,
) -> Client[UserT] | None:
"""Get a client by the current websocket connection."""
return self._clients_by_websocket.get(websocket, None)
|
remove_client()
remove_client(client: Client[UserT]) -> None
Remove a client.
Source code in proxystore/p2p/relay/manager.py
| def remove_client(self, client: Client[UserT]) -> None:
"""Remove a client."""
self._clients_by_uuid.pop(client.uuid, None)
self._clients_by_websocket.pop(client.websocket, None)
|