posemesh-compute-node-runner-api
posemesh-compute-node-runner-api defines the narrow contract between the compute node
engine and capability-specific runners. The crate is intentionally tiny: it
contains no HTTP clients or storage logic, just the traits and data models a
runner needs in order to receive work, download inputs, and upload artifacts.
What lives here
- types.rs— serde-friendly structs mirroring the DMS lease envelope and task specification (- LeaseEnvelope,- TaskSpec).
- runner.rs— async traits that make up the runner interface:- Runner,- TaskCtx,- InputSource,- ArtifactSink,- ControlPlane, and helpers like- MaterializedInput.
- CRATE_NAME— a stable identifier used by workspace smoke tests to assert that every crate was compiled and linked.
Runner interface at a glance
- Runner— implement- capability()and- run()to register your capability.
- TaskCtx— passed to- run(), bundles the current lease, an input source, an artifact sink, and a control-plane for cancellation/progress.
- InputSource— abstraction over fetching CIDs from domain storage; comes with helpers to materialize CIDs to temp files.
- ArtifactSink— abstraction over uploading result artifacts; supports bytes, files, and optional multipart streaming.
- ControlPlane— lets runners observe cancellation and push progress / log events that will get relayed via heartbeats.
use Result;
use async_trait;
use ;
use json;
;
Development notes
- cargo test -p posemesh-compute-node-runner-apiexercises trait object safety and serde round-trips of the contract types.
- The crate is no_std-out-of-scope by design; runner implementers are expected to depend on Tokio and friends via their own crates.
- Changes here should be treated as breaking API changes for every runner, so prefer additive evolution and keep the interface documentable in a README.