streaming
frequenz.client.base.streaming ¤
Implementation of the grpc streaming helper.
Attributes¤
frequenz.client.base.streaming.InputT
module-attribute
¤
InputT = TypeVar('InputT')
The input type of the stream.
frequenz.client.base.streaming.OutputT
module-attribute
¤
OutputT = TypeVar('OutputT')
The output type of the stream.
Classes¤
frequenz.client.base.streaming.GrpcStreamBroadcaster ¤
Bases: Generic[InputT, OutputT]
Helper class to handle grpc streaming methods.
Source code in frequenz/client/base/streaming.py
Functions¤
__init__ ¤
__init__(
stream_name: str,
stream_method: Callable[[], AsyncIterator[InputT]],
transform: Callable[[InputT], OutputT],
retry_strategy: Strategy | None = None,
)
Initialize the streaming helper.
PARAMETER | DESCRIPTION |
---|---|
stream_name |
A name to identify the stream in the logs.
TYPE:
|
stream_method |
A function that returns the grpc stream. This function is called everytime the connection is lost and we want to retry.
TYPE:
|
transform |
A function to transform the input type to the output type. |
retry_strategy |
The retry strategy to use, when the connection is lost. Defaults to retries every 3 seconds, with a jitter of 1 second, indefinitely.
TYPE:
|
Source code in frequenz/client/base/streaming.py
new_receiver ¤
stop
async
¤
Stop the streaming helper.