nvflare.fuel.f3.streaming.blob_streamer module

class BlobHandler(blob_cb: Callable)[source]

Bases: object

handle_blob_cb(future: StreamFuture, stream: Stream, resume: bool, *args, **kwargs) int[source]
class BlobStream(blob: bytes | bytearray | memoryview | list, headers: dict | None)[source]

Bases: Stream

Constructor for stream

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

  • headers – Optional headers to be passed to the receiver

static buffer_len(buffer: bytes | bytearray | memoryview | list)[source]
read(chunk_size: int) bytes | bytearray | memoryview | list[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 BlobStreamer(byte_streamer: ByteStreamer, byte_receiver: ByteReceiver)[source]

Bases: object

register_blob_callback(channel, topic, blob_cb: Callable, *args, **kwargs)[source]
send(channel: str, topic: str, target: str, message: Message, secure: bool, optional: bool) StreamFuture[source]
class BlobTask(future: StreamFuture, stream: Stream)[source]

Bases: object