Home
Overview
Fundamentals
Glossary
Cheatsheet
API Reference
Quick Recipes
Deep Dive
Common Pitfalls and Gotchas
Persistent Storage
Stream reader.
Note: This class supports parametrization like StreamReader[T].
StreamReader.read_available(limit=None)Returns the available items from the stream.
Returns an empty list if no more data is currently available and
the stream is still open.
Returns `None` if the stream has been exhausted and closed without
an error; otherwise, raises the error passed during closing.
Args:
limit: The maximum number of items to return.
StreamReader.subscribe_once(executor, callback)Subscribes for a notification when new items are available or when the stream is closed.
Note: The `callback` will be invoked on the executor and is called
without any arguments.
When the `callback` is invoked, the subsequent `read_available()`
call is guaranteed to return a non-trivial result:
* a non-empty list if there are more items available,
* `None` if the stream was closed without an error, or
* raise an error if the stream was closed with an error.