class

Vow::Registry

Inherits Reference < Object

Holds the set of dispatchable procedures and turns a (name, raw JSON) pair into a raw JSON result. This is Vow's transport-agnostic seam: an HTTP adapter, a CLI, or a test harness all sit on dispatch and never touch how a procedure was generated.

Mount one or more services to populate it — Vow::Registry.new(api, other) or registry.mount(api). Mounting binds each service instance's exported methods (the generated callbacks close over that instance) and records its static descriptors, so the registry can also answer #manifest for codegen and introspection.

Constructors

new(*services : Vow::Mountable)
Source

Class methods

decode(type : T.class, arg : JSON::Any) : T forall T

Trust boundary: decode one positional arg into its declared type, turning any parse/shape failure into a typed bad_input instead of a raw crash. Called once per arg by the generated callbacks.

Source

Instance methods

add_descriptors(descriptors : Array(ProcedureDescriptor)) : Nil

Called by the generated vow_install to record a service's static descriptors alongside its runtime callbacks.

Source
add_types(types : Array(TypeDescriptor)) : Nil

Records a service's captured surface types. Deduped at #manifest time so types shared across mounted services appear once.

Source
dispatch(name : String, raw_json : String, context : Context | Nil = nil) : String

The seam transports sit on: procedure name + raw JSON args object in, raw JSON result out. Typed Vow::Errors (not-found, bad-input, decode failures) propagate to the caller, which is responsible for turning them into a transport-appropriate envelope.

context is the optional per-call Context a transport supplies; it reaches only the methods that opt in by declaring a leading Context parameter. Defaulting to nil keeps the bare dispatch(name, args) call — used by context-free transports and tests — working unchanged.

Source
includes?(name : String) : Bool
Source
manifest

The static contract of everything mounted here — for codegen, an introspection endpoint, or a health check.

Source
mount(service : Vow::Mountable) : self

Bind a service instance into this registry. Returns self for chaining. Accepts anything Vow::Mountable — a class that mixed in either Vow::Exportable or Vow::Exportable::All.

Source
names

Names of every registered procedure, in insertion order — handy for introspection, health checks, and "did you mean?" diagnostics.

Source
register(name : String, &callback : Hash(String, JSON::Any), Context | Nil -> JSON::Any) : Nil
Source