ReductionBounds.RpcCost (ReductionBounds v0.1.0)

Copy Markdown View Source

Conditional participant-specific budgets for the supplied single-attempt RPC.

Rates are finite natural upper envelopes, each with :upper_bound and :cost_unit (:client_work or :server_work). Every operation returned by operations/0 must be declared, except :handle_request, supplied by the server contract. Zero is allowed only as an explicit declaration.

Client envelopes apply under the RPC sizes, matching program, queue cap (initial_messages + arrivals) and count conditions. Server receive/send envelopes apply under the independent server frame. They must include all work assigned to those modeled operations, including server selection work. Choosing finite rates asserts their applicability; this module does not derive VM costs from sizes. Large integers, copies and guard traversal must be covered by the supplied envelopes.

RpcCostProof.build/3 checks a finite timeline and constructs universal conditional cost-safety and prefix theorems. Builders retain :not_checked until submitted to the existing verification boundary. Bounds count mailbox inspection, pattern attempts and guard attempts separately, without charging coarse receive/inspect observations again. Client and server units are never added. This stage does not establish RPC completion or source correspondence.

Summary

Functions

new(conditions, rates, server, options)

@spec new(map(), map(), map(), keyword()) :: {:ok, map()} | {:error, term()}

operations()

@spec operations() :: [atom()]