karapace/crates/karapace-core/src/lib.rs
Marco Allegretti 6e66c58e5e core: add build options
Introduce BuildOptions to parameterize build and rebuild.

Add build_with_options/rebuild_with_options to support locked, offline, and
require-pinned-image modes. Locked mode verifies an existing lock file and
fails on drift. Offline mode fails fast when system packages are requested.
Also re-export BuildOptions from karapace-core.
2026-02-23 18:29:18 +01:00

40 lines
1.5 KiB
Rust

//! 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};
pub use engine::{BuildOptions, BuildResult, Engine};
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),
}