Hive.Addr
hive · API reference
Typed send capabilities.
A typed send capability — the PID analog.
An address is the only way to put a message in a worker's mailbox. It is typed by the message it accepts, so illegal sends are unrepresentable. Local-only in hive.core; the cluster layer extends addressing with node identity and incarnation fencing.
type 'msg tAn address accepting messages of type 'msg.
The type parameter is the send contract. If a worker expects Counter.Incr, an address for string cannot be used by accident.
val send : 'msg t -> 'msg -> (unit, [ `Closed ]) resultsend addr msg enqueues msg in the target mailbox. Blocks when the mailbox is full (backpressure). Error Closed` if the target has stopped.
ocaml]
match Hive.Addr.send counter_addr `Incr with
| Ok () -> ()
| Error `Closed -> traceln "counter is gone"val id : _ t -> intProcess-unique identifier of the address.
This is useful for logging and local diagnostics, not for persistence or cross-process addressing.
val equal : _ t -> _ t -> boolIdentity comparison (by id).
The message types may differ because equality checks only local address identity.
val make : enqueue:('msg -> (unit, [ `Closed ]) result) -> 'msg tRuntime constructor used by Worker and Server; applications normally never call this.
It is mainly useful for adapters, for example mapping a remote Unreachable` send into the local Closed` convention.