nvflare.fuel.f3.streaming.byte_receiver module

class ByteReceiver(cell: CoreCell)[source]

Bases: object

register_callback(channel: str, topic: str, stream_cb: Callable, *args, **kwargs)[source]
stop_task(task: RxTask, error: StreamError | None = None, notify=True)[source]
class RxStream(byte_receiver: ByteReceiver, task: RxTask)[source]

Bases: Stream

A stream that’s used to read streams from the buffer

Constructor for stream

Parameters:
  • size – The total size of stream. 0 if unknown

  • headers – Optional headers to be passed to the receiver

close()[source]

Close the stream

read(chunk_size: int) bytes[source]

Read and return up to chunk_size bytes. It can return less but not more than the chunk_size. An empty bytes object is returned if the stream reaches the end.

Parameters:

chunk_size – Up to (but maybe less) this many bytes will be returned

Returns:

Binary data. If empty, it means the stream is depleted (EOF)

class RxTask(sid: int, origin: str)[source]

Bases: object

Receiving task for ByteStream