Commit Graph
3 Commits
Author SHA1 Message Date
Eric Coissac f68243cde0 refactor: implement fail-fast error handling and panic recovery in pipelines
Introduce robust error propagation for multi-threaded pipelines, ensuring that
errors in sources, stages, or sinks cause immediate termination. Add support
for catching worker panics and converting them into structured errors, and
enforce strict validation of worker pool and throttle configuration.

- Add `WorkerPanic` struct and variant to `PipelineError` in `src/scheduler/error.rs`,
  along with `panic_error` helper to convert panic payloads into errors.
- Modify `WorkerPool::run` in `src/scheduler/pool.rs` to return `Result<(), PipelineError>`,
  propagate errors from sources/sinks, and detect uncaught panics in worker threads.
- Update `source_runner` and `transform_runner` in `src/scheduler/runner.rs` to send
  errors to the scheduler instead of printing to stderr, and use `catch_unwind` to
  handle panics in transformation stages, including flat transforms.
- Refactor `PipeIter` in `src/scheduler/pipe.rs` to include a `finish` method that
  joins the worker thread and returns a `Result`, replacing implicit drop-based
  error handling with explicit error reporting.
- Update `make_pipeline!` and `make_pipe!` macros in `src/scheduler/macros.rs` to
  signal errors via `-1` delta, and add documentation examples for pipeline usage.
- Add `Flat` variant to `Stage` enum in `src/scheduler/types.rs` to support flat
  transformation stages in the scheduler.
- Enhance `Throttle` in `src/throttle.rs` with a `lock` method for mutex management,
  poison error recovery, and validation that `max > 0` in the constructor.
- Add comprehensive tests in `tests/errors.rs` covering error propagation, panic
  recovery, capacity/worker validation, and pipeline execution flow.
- Update `README.md` to document "Errors and limits", detailing fail-fast behavior,
  error handling in `PipeIter` and `WorkerPool::run()`, and constraints on arguments.
- Set `rust-version = "1.85"` and update description in `Cargo.toml`.
- Update `examples/sandbox_pipeline.rs` to use `.expect("pipeline failed")` on
  `WorkerPool::run()` to demonstrate error handling.
2026-12-02 15:46:18 +01:00
Eric Coissac e14fb6a287 feat: add obipipeline crate with typed multi-threaded pipelines
Release / release (push) Successful in 1m12s
Introduce the `obipipeline` crate, providing typed, composable multi-threaded
pipelines with memory-bounded throttling. The crate includes a scheduler for
managing pipeline stages, a throttle mechanism for concurrency control, and
comprehensive build and release tooling via `.crate-kit`.

- Add `Cargo.toml`, `Cargo.lock`, and `Makefile` to define the `obipipeline`
  package (v0.1.1) with `crossbeam-channel` dependency and build targets.
- Add `LICENSE` and `LICENSE.en` files containing the CeCILL free software
  license agreement under French law.
- Add `.gitignore` to exclude `target` and `/.cargo/config.toml` from version
  control.
- Add `.crate-kit/` directory with build configuration (`VERSION`, `crate.mk`,
  `org.mk`, `dev-patch.mk`, `jj.mk`) and 21 shell scripts for API tracking,
  dependency management, release workflows, and wiki generation.
- Add `.gitea/workflows/release.yaml` to automate releases on tag pushes,
  including building, publishing, and updating the wiki.
- Add `src/lib.rs` to expose `scheduler` and `throttle` modules, re-exporting
  core types like `Pipe`, `Pipeline`, `WorkerPool`, and `Throttle`.
- Add `src/scheduler/` module with `error.rs` (`PipelineError`), `macros.rs`
  (`make_pipe!`, `make_pipeline!`), `pipe.rs` (`Pipe`, `PipeIter`),
  `pool.rs` (`Pipeline`, `WorkerPool`), `runner.rs` (thread runners), and
  `types.rs` (`Stage`, `WorkerTask`, function aliases).
- Add `src/throttle.rs` implementing `Throttle`, `ThrottleGuard`, and
  `throttle` function for memory-bounded concurrency control using semaphores.
- Add `api/` directory with public API snapshots (`0.1.0`, `0.1.1`) in JSON,
  text, and stamp formats for version tracking.
- Add `examples/sandbox_pipeline.rs` demonstrating pipeline construction with
  `make_pipeline!` and `WorkerPool` using sample transformation steps.
- Add `tests/pipe.rs` with tests for pipe composition, flat transforms, and
  empty input handling.
- Add `tests/throttle.rs` with tests verifying throttle ordering, concurrency
  bounds, and guard blocking behavior.
- Update `README.md` with documentation for `obipipeline`, including core
  concepts, API details, and installation instructions.
version-0.1.1
2026-12-01 19:49:09 +01:00
coissac 873f7f7f24 Ajouter README.md 2026-12-01 18:15:19 +00:00