Skip to content

hpca-uji/streamview

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

streamview

Zero-copy non-blocking pipe-like structure

Install

Production

pip install streamview

Development

git clone https://github.com/hpca-uji/streamview.git
cd streamview
pip install -e .

Documentation

Classes

  • 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, copy and deepcopy support.

    Extends: BufferedIOBase

    • nbytes -> int

      Number of bytes held in stream

    • nchunks -> int

      Number of chunks held in stream

    • readchunk() -> memoryview

      Read a chunk from stream

    • unreadchunk(chunk: memoryview) -> int

      Unread a chunk into the stream

    • readchunk() -> memoryview

      Read a chunk from stream

    • unwritechunk() -> memoryview

      Unwrite a chunk from the stream

    • writechunk(chunk: memoryview) -> int

      Write a chunk into the stream

    • peekchunk() -> memoryview

      Peek a chunk from stream

    • readchunks() -> Iterable[memoryview]

      Read all chunks from stream

    • writechunks(chunks: Iterable[memoryview]) -> int

      Write many chunks into the stream

    • update(bs: Iterable[Buffer]) -> int

      Write many buffers into the stream

    • clear() -> None

      Release all chunks

    • copy() -> Stream

      Shallow copy of stream

    • tobytes() -> bytes

      Transform stream to bytes (will copy)

    • frombytes(b: Buffer) -> Stream

      Construct a stream from bytes

Functions

  • byteview(b: Buffer) -> memoryview

    Return a byte view of a buffer

Acknowledgments

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).

About

Zero-copy non-blocking pipe-like structure

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages