feat: karapace-core — engine orchestration, lifecycle state machine, drift control
- Engine: init → resolve → lock → build → enter/exec → freeze → archive → destroy
- Cached store_root_str avoiding repeated to_string_lossy() allocations
- WAL-protected build, enter, exec, destroy, commit, restore, GC operations
- Overlay drift detection: diff/commit/export via upper_dir scanning
- Deterministic snapshot commit with composite identity hashing
- Atomic restore via staging directory swap
- StoreLock: compile-time enforcement via type parameter on gc()
- Signal handler: SIGINT/SIGTERM graceful shutdown with AtomicBool
- Push/pull delegation to karapace-remote backend
- Crash recovery: stale .running marker cleanup on Engine::new()
- Integration tests, E2E tests, crash injection tests, ENOSPC simulation
- Criterion benchmarks: build, rebuild, commit, restore, GC, verify
2026-02-22 17:37:02 +00:00
|
|
|
//! Core orchestration engine for Karapace environment lifecycle.
|
|
|
|
|
//!
|
|
|
|
|
//! This crate ties together schema parsing, store operations, and runtime backends
|
|
|
|
|
//! into the `Engine` — the central API for building, entering, stopping, destroying,
|
|
|
|
|
//! and inspecting deterministic container environments. It also provides overlay
|
|
|
|
|
//! drift detection, concurrent store locking, and state-machine lifecycle validation.
|
|
|
|
|
|
|
|
|
|
pub mod concurrency;
|
|
|
|
|
pub mod drift;
|
|
|
|
|
pub mod engine;
|
|
|
|
|
pub mod lifecycle;
|
|
|
|
|
|
|
|
|
|
pub use concurrency::{install_signal_handler, shutdown_requested, StoreLock};
|
|
|
|
|
pub use drift::{commit_overlay, diff_overlay, export_overlay, DriftReport};
|
2026-02-23 17:29:18 +00:00
|
|
|
pub use engine::{BuildOptions, BuildResult, Engine};
|
feat: karapace-core — engine orchestration, lifecycle state machine, drift control
- Engine: init → resolve → lock → build → enter/exec → freeze → archive → destroy
- Cached store_root_str avoiding repeated to_string_lossy() allocations
- WAL-protected build, enter, exec, destroy, commit, restore, GC operations
- Overlay drift detection: diff/commit/export via upper_dir scanning
- Deterministic snapshot commit with composite identity hashing
- Atomic restore via staging directory swap
- StoreLock: compile-time enforcement via type parameter on gc()
- Signal handler: SIGINT/SIGTERM graceful shutdown with AtomicBool
- Push/pull delegation to karapace-remote backend
- Crash recovery: stale .running marker cleanup on Engine::new()
- Integration tests, E2E tests, crash injection tests, ENOSPC simulation
- Criterion benchmarks: build, rebuild, commit, restore, GC, verify
2026-02-22 17:37:02 +00:00
|
|
|
pub use lifecycle::validate_transition;
|
|
|
|
|
|
|
|
|
|
use thiserror::Error;
|
|
|
|
|
|
|
|
|
|
#[derive(Debug, Error)]
|
|
|
|
|
pub enum CoreError {
|
|
|
|
|
#[error("manifest error: {0}")]
|
|
|
|
|
Manifest(#[from] karapace_schema::ManifestError),
|
|
|
|
|
#[error("lock error: {0}")]
|
|
|
|
|
Lock(#[from] karapace_schema::LockError),
|
|
|
|
|
#[error("store error: {0}")]
|
|
|
|
|
Store(#[from] karapace_store::StoreError),
|
|
|
|
|
#[error("runtime error: {0}")]
|
|
|
|
|
Runtime(#[from] karapace_runtime::RuntimeError),
|
|
|
|
|
#[error("invalid state transition: {from} -> {to}")]
|
|
|
|
|
InvalidTransition { from: String, to: String },
|
|
|
|
|
#[error("environment not found: {0}")]
|
|
|
|
|
EnvNotFound(String),
|
|
|
|
|
#[error("I/O error: {0}")]
|
|
|
|
|
Io(#[from] std::io::Error),
|
|
|
|
|
#[error("serialization error: {0}")]
|
|
|
|
|
Serialization(#[from] serde_json::Error),
|
|
|
|
|
#[error("remote error: {0}")]
|
|
|
|
|
Remote(#[from] karapace_remote::RemoteError),
|
|
|
|
|
}
|