ergo-runtime 0.1.0-alpha.1

Canonical primitive contracts and reference implementations for the Ergo graph execution engine
Documentation
pub mod execute;
pub mod types;
pub mod validate;

pub use execute::{execute, execute_with_metadata};
pub use types::*;
pub use validate::validate;

#[cfg(test)]
mod tests;

use crate::cluster::{ExpandedGraph, PrimitiveCatalog};

#[derive(Debug)]
#[non_exhaustive]
pub enum RuntimeError {
    Validation(types::GraphValidationError),
    Execution(types::ExecError),
}

/// Canonical execution entrypoint.
/// Validates the expanded graph before executing it with the provided registries and context.
pub fn run<C: PrimitiveCatalog>(
    expanded: &ExpandedGraph,
    catalog: &C,
    registries: &types::Registries,
    ctx: &types::ExecutionContext,
) -> Result<types::ExecutionReport, RuntimeError> {
    let validated = validate(expanded, catalog).map_err(RuntimeError::Validation)?;
    execute(&validated, registries, ctx).map_err(RuntimeError::Execution)
}