venus_core/execute/mod.rs
1//! Execution engine for Venus notebooks.
2//!
3//! Provides linear, parallel, and process-isolated cell execution with hot-reload support.
4//!
5//! # Executors
6//!
7//! - **`LinearExecutor`** - In-process sequential execution. Fast but no isolation.
8//! - **`ParallelExecutor`** - In-process parallel execution using Rayon.
9//! - **`ProcessExecutor`** - Process-isolated execution. Cells run in worker processes
10//! that can be killed for true interruption. Provides crash isolation, memory isolation,
11//! and immediate cancellation.
12//!
13//! # Architecture
14//!
15//! ## In-Process Execution (LinearExecutor, ParallelExecutor)
16//!
17//! ```text
18//! CompiledCell
19//! │
20//! └── LoadedCell (dylib loaded via libloading)
21//! │
22//! └── LinearExecutor / ParallelExecutor
23//! │
24//! └── FFI call → cell entry point
25//! │
26//! └── Output stored in StateManager
27//! ```
28//!
29//! ## Process-Isolated Execution (ProcessExecutor)
30//!
31//! ```text
32//! ProcessExecutor (parent)
33//! │
34//! └── WorkerPool
35//! │
36//! └── WorkerHandle (manages child process)
37//! │
38//! ├── IPC: LoadCell command
39//! │ └── venus-worker loads dylib
40//! │
41//! ├── IPC: Execute command
42//! │ └── venus-worker calls FFI
43//! │ └── Returns serialized output
44//! │
45//! └── SIGKILL for immediate interruption
46//! ```
47//!
48//! # Module Structure
49//!
50//! - `context` - Execution callbacks and cell context
51//! - `executor` - LinearExecutor for sequential execution
52//! - `ffi` - FFI types and dispatch macros
53//! - `loaded_cell` - LoadedCell wrapper for dylibs
54//! - `parallel` - ParallelExecutor for concurrent execution
55//! - `process` - ProcessExecutor for isolated execution
56//! - `reload` - Hot-reload support
57//! - `windows_dll` - Windows DLL hot-reload handler
58
59mod context;
60mod executor;
61mod ffi;
62mod loaded_cell;
63mod parallel;
64mod process;
65mod reload;
66mod windows_dll;
67
68pub use context::{AbortHandle, CellContext, ExecutionCallback};
69pub use executor::LinearExecutor;
70pub use ffi::ExecutionResult;
71pub use loaded_cell::LoadedCell;
72pub use parallel::ParallelExecutor;
73pub use process::{ExecutorKillHandle, ProcessExecutor};
74pub use reload::HotReloader;
75pub use windows_dll::WindowsDllHandler;