Skip to content

Cookbook

Every recipe here lives at cookbook/<name>/ in the fabricBIOS source tree as a real cargo workspace member. The README you’re reading and the src/*.rs you’re copying come from the same crate; if a signature changes upstream the recipe fails CI before this page goes stale.

Recipes

  • hello-tasklet — the smallest working tasklet. Five functions, one output JSON. Start here.
  • distributed-counter — atomic increment on leased fabric memory. Multiple writers, one counter.
  • shared-listFabricVec append. Two writers, one list.
  • object-storage — content-addressable object store with SHA-256 + CRC32.
  • stream-pipeline — Source / Transform / Sink with FabricQueue inter-stage buffering.
  • rpc-service — typed request/response over a leased queue. Ping / Echo / Reverse.
  • local-dev — iterate against a project-local fabric with grafos dev up / down / doctor.

Pattern across recipes

Every recipe extracts a deterministic compute() function from the WASM tasklet entry point. The compute function:

  • Takes a &[u8] input.
  • Returns a Result (or a value type whose error variant is part of the response enum).
  • Has unit tests that run on the host without a WASM runtime.

The wasm32 entry point wraps compute() with pointer marshaling. This split is intentional — it lets you test the logic with cargo test, then ship the same code as a tasklet by recompiling for wasm32-unknown-unknown.

The tasklet ABI signature tasklet_run(in_ptr, in_len, out_ptr, out_cap) -> i32 matches tasklet-profile-v0. See Tasklet ABI for the byte-level contract.

How recipes stay current

Each recipe’s source is a workspace member in fabricBIOS/Cargo.toml’s members list. CI runs cargo check and cargo test on every change. A signature change in grafos-collections::FabricVec or grafos-store::MemObjectStore that breaks a recipe fails the build before it ships.

Test coverage today: 22 unit tests across the 7 recipes, all green.