feat: add obipipeline crate with typed multi-threaded pipelines
Release / release (push) Successful in 1m12s
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.
This commit is contained in:
1 parent
873f7f7f24
commit
e14fb6a287
54 files changed
+4763
No files matched your search
Executable
+77
@@ -0,0 +1,77 @@
|
||||
#!/usr/bin/env bash
|
||||
# Is there, in the crate's jj working copy (current directory), a change that justifies a
|
||||
# commit, that is, something other than what the kit itself produces or modifies? Read-only.
|
||||
#
|
||||
# Do not count:
|
||||
# - .crate-kit/ (kit copy) and .cargo/ (generated local configuration);
|
||||
# - a template file (.gitea/workflows/release.yaml, LICENSE, .gitignore, Makefile…) identical to
|
||||
# that of the kind's template (<extension>/templates/<kind>, otherwise crate-kit/template): adopt.sh laid it down as is;
|
||||
# - Cargo.lock when only the `version` line of the crate itself changed (version bump);
|
||||
# - the Makefile when only its kit bootstrap lines changed (KIT_SRC, copy or sync of
|
||||
# .crate-kit/, comments that talk about the kit): the rest (description, PLUGIN_ID…) belongs to the crate.
|
||||
# Without a crate-kit repository alongside ($KIT_SRC), the second filter cannot apply: these files
|
||||
# then count as changes.
|
||||
#
|
||||
# Output: one file per line on standard output. Code 0 if there are any, 1 otherwise (nothing to commit).
|
||||
set -euo pipefail
|
||||
. "$(dirname "$0")/common.sh"
|
||||
|
||||
kit_src="${KIT_SRC:-../crate-kit}"
|
||||
kind="${CRATE_KIND:-}"
|
||||
if [ -z "$kind" ] && [ -f Makefile ]; then
|
||||
kind=$(sed -n 's/^CRATE_KIND *[:?]*= *\([a-z]*\).*/\1/p' Makefile | head -n 1)
|
||||
fi
|
||||
template="$("$kit_src/tools/kit-assemble.sh" --root)/template"
|
||||
overlay=$("$kit_src/tools/kit-assemble.sh" --overlay 2>/dev/null || true)
|
||||
[ -n "$kind" ] && [ -n "$overlay" ] && [ -d "$overlay/templates/$kind" ] && template="$overlay/templates/$kind"
|
||||
|
||||
# Cargo.lock: did only the `version` line of the crate's package change?
|
||||
lock_is_version_bump() {
|
||||
local name
|
||||
name=$(crate_name)
|
||||
jj diff --git --context 1 Cargo.lock 2>/dev/null | awk -v name="$name" '
|
||||
/^(\+\+\+|---)/ { next }
|
||||
/^@@/ { prev = ""; next }
|
||||
/^[-+]/ {
|
||||
changed++
|
||||
if ($0 !~ /^[-+]version = / || prev != " name = \"" name "\"") bad = 1
|
||||
next
|
||||
}
|
||||
/^ / { prev = $0 }
|
||||
END { exit (changed > 0 && !bad) ? 0 : 1 }'
|
||||
}
|
||||
|
||||
# Makefile: did only the kit bootstrap lines change? Those that name KIT_SRC or
|
||||
# `crate-kit` (variable, sync, copy of .crate-kit/) and the comments that talk about the kit; a
|
||||
# modification of any other line (description, PLUGIN_ID, targets) is a real change of the crate.
|
||||
makefile_is_kit_bootstrap() {
|
||||
jj diff --git --context 1 Makefile 2>/dev/null | awk '
|
||||
/^(\+\+\+|---)/ { next }
|
||||
/^[-+]/ {
|
||||
changed++
|
||||
if ($0 !~ /KIT_SRC|crate-kit|kit-copy|^[-+]# .*[Kk]it/) bad = 1
|
||||
}
|
||||
END { exit (changed > 0 && !bad) ? 0 : 1 }'
|
||||
}
|
||||
|
||||
found=0
|
||||
while IFS= read -r line; do
|
||||
# Format of `jj diff --summary`: "M path"; a rename "R {a => b}" remains a change.
|
||||
path="${line#? }"
|
||||
case "$path" in
|
||||
.crate-kit/* | .cargo/*) continue ;;
|
||||
Cargo.lock)
|
||||
if lock_is_version_bump; then continue; fi
|
||||
;;
|
||||
Makefile)
|
||||
if makefile_is_kit_bootstrap; then continue; fi
|
||||
;;
|
||||
esac
|
||||
if [ "${line%% *}" = M ] && [ -f "$template/$path" ] && cmp -s "$template/$path" "$path"; then
|
||||
continue
|
||||
fi
|
||||
echo "$path"
|
||||
found=1
|
||||
done < <(jj diff --summary)
|
||||
|
||||
[ "$found" -eq 1 ] || { info " nothing to commit outside the kit" ; exit 1; }
|
||||
Reference in new issue
Block a user