Skip to main content

Module stream

Module stream 

Source
Expand description

Server-streaming dispatch for Python plugins (FIDIUS-I-0026).

A streaming plugin method returns a Python generator (or any iterable). super::handle::PythonPluginHandle::call_streaming_start calls the method to obtain its iterator and wraps it in a PythonStream.

PythonStream is the sync, GIL-aware half of the bridge: it advances the iterator one item at a time (PythonStream::next, holding the GIL only for that step) and runs the generator’s cleanup on cancellation (PythonStream::cancelgen.close()GeneratorExit/finally). The async half — pumping it onto a ChunkStream over a bounded channel with backpressure — lives in fidius-host’s Pyo3Executor, which owns the tokio machinery. Keeping PyO3 here and tokio there respects the existing crate split (fidius-python has no async runtime).

Structs§

PythonStream
A handle to an in-flight Python server-stream — the iterator obtained by calling a streaming plugin method.

Enums§

PyStreamStep
One step of advancing a Python plugin’s server-streaming iterator.