valis / Reference / API reference

Registry - API reference

Exported surface for the registry subsystem. Part of the API reference.

Package valis/src/registry

Classes

registry

A mapping from TCP/IP port to the protocol plugin that answers on it. A port is claimed by at most one protocol, mirroring the one-program-per-port model valis replaces — except here the program is a uniform, user-owned plugin.

Conditions

no-protocol-for-port

Signalled by DISPATCH-CONNECTION when a connection arrives on a port with no protocol registered. Carries the offending PORT.

port-already-claimed

Signalled by REGISTER-PROTOCOL when a port is already claimed by another protocol and replacement was not requested. Carries the contested PORT and the EXISTING protocol that holds it.

Generic functions

no-protocol-for-port-port

(no-protocol-for-port-port condition)

Undocumented: this exported symbol needs a docstring.

port-already-claimed-port

(port-already-claimed-port condition)

Undocumented: this exported symbol needs a docstring.

Functions

dispatch-connection

(dispatch-connection port connection &key (registry *registry*))

Route CONNECTION, which arrived on PORT, to its protocol's HANDLE-CONNECTION. Signals NO-PROTOCOL-FOR-PORT when nothing claims PORT.

find-protocol

(find-protocol port &key (registry *registry*))

Return the protocol registered for PORT in REGISTRY, or NIL.

make-registry

(make-registry)

Create an empty protocol registry.

register-protocol

(register-protocol protocol &key (registry *registry*) (replace nil))

Register PROTOCOL on each of its ports in REGISTRY. Signals PORT-ALREADY-CLAIMED if a port is taken, unless REPLACE is true. Returns PROTOCOL.

registered-protocols

(registered-protocols &key (registry *registry*))

Return the distinct protocols currently registered in REGISTRY.

unregister-protocol

(unregister-protocol protocol &key (registry *registry*))

Remove PROTOCOL from every port it claims in REGISTRY. Returns PROTOCOL.

Variables

*registry*

The process-wide protocol registry dispatched against by DISPATCH-CONNECTION.