1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright 2026 Colliery, Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//! `PluginExecutor` — the dispatch seam across execution backends.
//!
//! Fidius historically carried one dispatch implementation per backend: the
//! cdylib vtable/FFI path lived inside `PluginHandle`, and the Python (PyO3)
//! path lived in a *separate* `PythonPluginHandle` in `fidius-python`. This
//! module collapses that duplication: each backend is an executor, and the
//! caller-facing [`crate::handle::PluginHandle`] wraps them in an **enum**
//! (`Backend`) so its generic `call_method<I, O>` can serialise with each
//! backend's native currency.
//!
//! ## Why an enum, not `Box<dyn>` — and why two traits
//!
//! The backends do **not** share a typed wire. cdylib decodes concrete-type
//! **bincode** (not self-describing — it can't be reconstructed from an erased
//! value), while Python (and the future WASM component backend) consume a
//! self-describing [`fidius_core::Value`]. A single `call(method, Value)` trait
//! method therefore cannot serve cdylib without breaking its ABI (see
//! FIDIUS-A-0003 / FIDIUS-I-0021 amendment). So:
//!
//! - [`PluginExecutor`] is the **common** surface every backend shares:
//! metadata plus the raw byte path. For cdylib, `call_raw` is *also* the
//! carrier for typed calls (the wrapper bincode-wraps the concrete type).
//! - [`ValueExecutor`] adds the typed [`fidius_core::Value`] call, implemented
//! only by the self-describing backends (Python, WASM). cdylib does not
//! implement it — `PluginHandle` routes cdylib typed calls through its own
//! bincode `call_method`, keeping the bytes byte-identical to pre-refactor.
use Value;
use crateCallError;
use cratePluginInfo;
pub use CdylibExecutor;
pub use Pyo3Executor;
pub use ;
/// The surface every execution backend shares.
///
/// Implementations must be `Send + Sync`: methods take `&self`, so a handle can
/// be shared across threads as long as the backend is internally thread-safe.
/// Backends whose typed boundary is the self-describing [`Value`] model —
/// Python today, and the Phase-2 WASM component executor.
///
/// cdylib deliberately does **not** implement this: its typed path is
/// concrete-type bincode, which `Value` cannot reproduce. `PluginHandle`
/// dispatches cdylib typed calls directly via bincode instead.