common.cluster
Cluster utilities for executing operations across multiple nodes.
- async execute_on_cluster(clients: List[Any], operation: Callable[[Any], Any]) ByNodeName[source]
Execute an operation on all nodes in the cluster.
- Parameters:
clients – List of node clients
operation – Function to execute on each client
- Returns:
Dictionary mapping node DIDs to operation results
- prepare_plaintext_request(options: Dict[str, Any]) Dict[Did, Any][source]
Prepares a plaintext request by replicating the body for each node.
- Parameters:
options – Dictionary containing ‘clients’ and ‘body’
- Returns:
Dictionary mapping node DIDs to request payloads
- async prepare_concealed_request(options: Dict[str, Any]) Dict[Did, Any][source]
Prepares a request by concealing its data for distribution to all nodes.
- Parameters:
options – Dictionary containing ‘key’, ‘clients’, and ‘body’
- Returns:
Dictionary mapping node DIDs to encrypted payloads
- process_plaintext_response(results: ByNodeName, strategy: str = 'first') Any[source]
Selects a single canonical response from a map of node results.
- Parameters:
results – Dictionary of results by node
strategy – Strategy for selecting response (“first” or “random”)
- Returns:
Selected response