Zero-copy non-blocking pipe-like structure
pip install streamviewgit clone https://github.com/hpca-uji/streamview.git
cd streamview
pip install -e .-
Stream()Zero-copy non-blocking pipe-like
Interface mimics a non-blocking BufferedIOBase, but operations return memoryviews instead of bytes.
Operations are not thread-safe. Reader is responsible of releasing chunks. Writer hands off responsibility over chunks.
Stream has
with,bytes,bool,copyanddeepcopysupport.Extends:
BufferedIOBase-
nbytes -> intNumber of bytes held in stream
-
nchunks -> intNumber of chunks held in stream
-
readchunk() -> memoryviewRead a chunk from stream
-
unreadchunk(chunk: memoryview) -> intUnread a chunk into the stream
-
readchunk() -> memoryviewRead a chunk from stream
-
unwritechunk() -> memoryviewUnwrite a chunk from the stream
-
writechunk(chunk: memoryview) -> intWrite a chunk into the stream
-
peekchunk() -> memoryviewPeek a chunk from stream
-
readchunks() -> Iterable[memoryview]Read all chunks from stream
-
writechunks(chunks: Iterable[memoryview]) -> intWrite many chunks into the stream
-
update(bs: Iterable[Buffer]) -> intWrite many buffers into the stream
-
clear() -> NoneRelease all chunks
-
copy() -> StreamShallow copy of stream
-
tobytes() -> bytesTransform stream to bytes (will copy)
-
frombytes(b: Buffer) -> StreamConstruct a stream from bytes
-
-
byteview(b: Buffer) -> memoryviewReturn a byte view of a buffer
The library has been partially supported by:
- Project PID2023-146569NB-C22 "Inteligencia sostenible en el Borde-UJI" funded by the Spanish Ministry of Science, Innovation and Universities.
- Project C121/23 Convenio "CIBERseguridad post-Cuántica para el Aprendizaje FEderado en procesadores de bajo consumo y aceleradores (CIBER-CAFE)" funded by the Spanish National Cybersecurity Institute (INCIBE).
