pub struct PythonPluginHandle { /* private fields */ }Expand description
Loaded-and-validated handle to one Python plugin.
Implementations§
Source§impl PythonPluginHandle
impl PythonPluginHandle
pub fn descriptor(&self) -> &'static PythonInterfaceDescriptor
pub fn method_count(&self) -> usize
Sourcepub fn call_typed(
&self,
method_index: usize,
input_bincode: &[u8],
) -> Result<Vec<u8>, PythonCallError>
pub fn call_typed( &self, method_index: usize, input_bincode: &[u8], ) -> Result<Vec<u8>, PythonCallError>
Typed dispatch.
input_bincode is the bincode-encoded args tuple — the same byte
payload the cdylib path would receive. We use bincode here only
because every other fidius caller does; on the way into Python we
pivot through serde_json::Value (so the host’s I: Serialize works
for any type the macro accepts).
Sourcepub fn call_typed_json(
&self,
method_index: usize,
input_json: &[u8],
) -> Result<Vec<u8>, PythonCallError>
pub fn call_typed_json( &self, method_index: usize, input_json: &[u8], ) -> Result<Vec<u8>, PythonCallError>
Typed dispatch where the input is already JSON-serialised (the
host’s serde_json::to_vec(&input)). Returns JSON bytes the caller
serde_json::from_slice::<O> decodes.
Sourcepub fn call_client_streaming_json(
&self,
method_index: usize,
items: Box<dyn Iterator<Item = Value> + Send>,
args_json: &[u8],
) -> Result<Vec<u8>, PythonCallError>
pub fn call_client_streaming_json( &self, method_index: usize, items: Box<dyn Iterator<Item = Value> + Send>, args_json: &[u8], ) -> Result<Vec<u8>, PythonCallError>
Client-streaming call (FIDIUS-I-0030 CS2.4): the host produces the stream
items (items_json, a JSON array); the plugin method receives them as a
host-backed iterator (its first positional arg) and returns a value.
args_json are the method’s non-stream args (a JSON array).
Sourcepub fn call_bidi_streaming_start(
&self,
method_index: usize,
items: Box<dyn Iterator<Item = Value> + Send>,
args_json: &[u8],
) -> Result<PythonStream, PythonCallError>
pub fn call_bidi_streaming_start( &self, method_index: usize, items: Box<dyn Iterator<Item = Value> + Send>, args_json: &[u8], ) -> Result<PythonStream, PythonCallError>
Bidirectional streaming (FIDIUS-I-0032 / ADR-0010): the method receives the
host-fed input iterator (its first positional arg, CS2.4) AND returns a
generator (ST). The host feeds items_json (input) and pumps the returned
generator (output); pulling the output pulls the input — the synchronous lazy-pull
composition. args_json are the non-stream args (a JSON array).
Sourcepub fn call_streaming_start(
&self,
method_index: usize,
input_json: &[u8],
) -> Result<PythonStream, PythonCallError>
pub fn call_streaming_start( &self, method_index: usize, input_json: &[u8], ) -> Result<PythonStream, PythonCallError>
Start a server-streaming call (FIDIUS-I-0026). Calls the method to obtain
its iterator/generator and wraps it in a crate::stream::PythonStream
the host then pumps. Input is JSON like Self::call_typed_json;
streaming methods use the typed (non-raw) path.