trellis-core 0.1.2

Deterministic reactive resource graph core types.
Documentation
  • Coverage
  • 100%
    317 out of 317 items documented0 out of 0 items with examples
  • Size
  • Source code size: 278.09 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 5.93 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 3s Average build duration of successful builds.
  • all releases: 5s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • pablof7z/trellis
    1 0 1
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • pablof7z

trellis-core

Deterministic resource graph primitives for Rust application kernels.

trellis-core is the runtime crate for Trellis. It models the part of an application where canonical state changes imply resource lifecycle changes: subscriptions, watchers, sync windows, materialized views, diagnostics, or other live demand that must be opened, closed, revised, and audited.

The graph does not perform I/O. It computes deterministic transaction results: derived values, structural diffs, resource plans, revisioned output frames, audit traces, and full-recompute checks. The host application applies returned plans and reports external status back as later canonical input.

canonical input changes
 -> derived nodes recompute
 -> collection diffs are produced
 -> resource plans are returned
 -> output frames are emitted
 -> tests can compare incremental state to full recompute

Status

Trellis is early and pre-1.0. The intended stable contract is semantic: transactions, explicit dependencies, structural diffs, scoped resource lifecycle, revisioned outputs, deterministic traces, and full-recompute checks.

Names and exact APIs may change before 1.0.

Install

[dependencies]
trellis-core = "0.1"

Optional serialization support:

[dependencies]
trellis-core = { version = "0.1", features = ["serde"] }

Quick Sketch

use trellis_core::{DependencyList, Graph};

#[derive(Clone, Debug, Eq, PartialEq)]
struct Command;

#[derive(Clone, Debug, Eq, PartialEq)]
struct Output;

fn main() -> trellis_core::GraphResult<()> {
    let mut graph = Graph::<Command, Output>::new_with_command_type();
    let mut tx = graph.begin_transaction()?;

    let source = tx.input::<u32>("source")?;
    tx.set_input(source, 1)?;

    let doubled = tx.derived(
        "doubled",
        DependencyList::new([source.id()])?,
        move |ctx| Ok(ctx.input(source)? * 2),
    )?;

    let result = tx.commit()?;
    drop(tx);

    assert_eq!(result.changed_inputs, vec![source.id()]);
    assert_eq!(graph.derived_value(doubled)?, Some(&2));

    Ok(())
}

What It Provides

  • Typed input, derived, and collection nodes.
  • Explicit dependency lists.
  • Atomic transactions.
  • Deterministic set/map collection diffs.
  • Data-only ResourcePlan<C> values.
  • Scoped resource ownership and teardown.
  • Revisioned materialized output frames.
  • Deterministic transaction traces and audit queries.
  • Full-recompute checks for supported graph shapes.

What It Does Not Do

trellis-core is not a UI framework, signal library, query cache, database, networking library, retry system, actor runtime, async scheduler, or macro DSL. It should sit inside a host-owned application kernel. The host owns I/O, runtime integration, retries, platform bridges, and real resource handles.

Documentation

The full project documentation is in the repository:

License

Licensed under MIT OR Apache-2.0.