Skip to main content

Module conc_registry

Module conc_registry 

Source
Expand description

Process-global named-actor registry (#444).

Keys are user-chosen String names; values are Value::Actor handles. The registry is flat (one namespace per process) — if two libraries need to avoid name collisions they prefix the string themselves. Access is serialised through a single Mutex because register/lookup/unregister all touch the same HashMap; contention is expected to be negligible (actor wiring happens once at main(), lookups serialise with the actor’s own mutex anyway).

Type tag. v1 stores Value::Actor opaquely — conc.lookup[S, M] parameterises the static return type but the runtime trusts the registration site. Reified (S, M) SigId tagging at register/lookup is the right design (see #444 option B) but requires plumbing compile-time type info into bytecode constants — deferred to a follow-up. The TypeMismatch variant of ConcError is reserved for that future check.

Enums§

RegError

Functions§

lookup
Look up an actor by name. Returns None if not registered.
register
Register actor under name. Returns Err if the name is already taken — registration is intentionally exclusive so the agent code catches the “two actors fighting over one name” bug at the source level rather than overwriting silently.
registered
Snapshot the current registered names (debug / introspection).
unregister
Unregister by name. Returns Err if the name isn’t registered. Existing Value::Actor handles held by callers continue to work; the actor cell is reclaimed when the last handle drops.