Go · Design

Design

1.0.0-rc.1 · b7577426

Ask your coding agent about this page, or add the docs server to it

curl -s 'https://www.unum.cloud/docs/ucall/go/design.md' | claude -p "How would this fit my code?"

The package is a thin layer over UCall’s native library, and every rule below follows from that.

  • Verbs share one name across languages. TakeCall, TakeCalls, TakeBatch, TakeBatches, Submit and TakeCompleted name the same calls as take_call and its siblings in C++, Python and Rust.
  • Blocking stays simple, deferring stays symmetric. A reply that is final on return answers an error, and one that may finish later answers (*Deferred[T], error), as Rust’s Deferring::answer hands back its refusal before submitting anything.
  • Ownership is a type, not a flag. A reply takes its Request, which the library clears once taken, only a DetachedRequest hands back a Deferred, and a Response is freed by Close or the collector.
  • Callbacks cross as handles. Routes, batch endpoints, log sinks and authorizers reach C as cgo.Handles the server or client deletes when closed, never as Go pointers; a route’s handle holds its handler alone, as each callback receives its server from the library.
  • One pinned frame per call. Each call pins one allocation holding its outcome, its argument structure and its result, polls included, and a refusal the binding catches allocates only its Error, before anything is pinned.
  • No life of its own. The package starts no goroutines, keeps no locks or counters, and recovers no panics, so it drops into any concurrency model.
PathGoRust
Blocking call1 frame0
Refusal before the call1 Error1 error
Deferred submit and wait4: frame, Deferred, 2 in AddCleanup0
Each callback1 Request0

A completion TakeCompleted lifts adds its Response and that response’s cleanup, and header lines or reply parts add the one array they cross as. TestCallsAllocateOnlyTheirFrames holds the first three rows.