2.2 KiB
2.2 KiB
Path A — kind = 'Rust
Default path. The op is compiled into the daemon binary via
inventory::collect! at link time. Full Rust type safety; replay-
deterministic by construction; zero runtime overhead.
Files
| File | Purpose |
|---|---|
greet_actor.ncl |
Catalog declaration — typechecks against schema-future.ncl |
greet_actor.rs |
Handler — copies to crates/ontoref-ops/src/ops/greet_actor.rs |
How to integrate into ontoref-el-proyecto
-
Copy the catalog declaration:
cp examples/catalog-extension/01-rust/greet_actor.ncl \ .ontoref/catalog/operations/greet_actor.ncl(Remove the
kind = 'Rustline if migration 0025 is not yet applied — the current schema doesn't accept the field but defaults the behaviour to Rust.) -
Copy the Rust handler:
cp examples/catalog-extension/01-rust/greet_actor.rs \ crates/ontoref-ops/src/ops/greet_actor.rs echo 'pub mod greet_actor;' >> crates/ontoref-ops/src/ops/mod.rs -
Author the matching validators (out of scope of this example):
actor_exists,tone_in_allowed_set,greeting_recorded— each as a#[onto_validator]function. Seecrates/ontoref-ops/src/precondition/for the pattern. -
Build and test:
cargo build -p ontoref-daemon cargo test -p ontoref-ops greet_actor -
Dispatch:
curl -X POST http://127.0.0.1:7891/ops/greet_actor \ -H "Authorization: Bearer $ONTOREF_TOKEN" \ -d '{"actor_id":"jpl","tone":"dao"}'
Key properties
- Witness coverage: the daemon signs the canonical serialisation of
the state delta (the new
current_statevalue in theactor-greetingFSM dimension). The signature attests the in-process computation. - No
evaluate_ondaodrequired in pre-validators: Rust ops can invokedispatch::call("evaluate_ondaod", …)inline when needed. The schema-level Hard constraintnon-rust-kinds-require-ondaod-preonly applies tokind != 'Rust. - Backward-compatible: omitting
kindin the declaration is equivalent to declaring'Rust(default).