Open ntninja opened 4 years ago
Happy to consider them. Is the implementation in a public repo already by any chance?
I don't have a sense for how general of a need these fill.
@belm0: Sorry I forgot the link! It's here: https://github.com/ipfs/py-datastore/blob/master/datastore/core/util/stream.py
As part of my work on ipfs/py-datastore I ended up creating two generic utilities that may be useful in the context of this repository as well:
TeeingReceive{Stream,Channel}
: Wraps an existingtrio.Receive{Stream,Channel}
and forwards all data received by the wrapped source to an arbitrary number of additionalReceive*
consumers using an in-memory channel for each.receive_{stream,channel}_from
: Creates atrio.ReceiveStream
from an arbitrary Python/bytes object, iterable or async iterable (returningtrio.ReceiveStream
s unchanged of course)Do these sound appropriate for inclusion into this library?