nvflare.fuel.utils.buffer_list module

class BufferList(buf_list: list)[source]

Bases: object

A buffer list that can be treated as a single buffer

append(buf: bytes)[source]
discard_before(offset: int) → None[source]

Release complete buffers ending at or before an absolute offset.

flatten()[source]
get_list()[source]
get_size()[source]
read(start: int, end: int)[source]
read_bytes(start: int, end: int) → bytes[source]

Read a range into one immutable bytes allocation.

Unlike read(), this method does not first assemble a multi-buffer range into a bytearray. This matters for large streamed FOBS sections: callers that require bytes would otherwise copy the complete range once into a bytearray and a second time into bytes.

class ConsumableBufferList(iterable=(), /)[source]

Bases: list

Buffer list whose owner permits readers to release consumed entries.