chip/registry
This module helps tag Subject
s under a name to later reference them.
Types
This is the message type used internally by group.
When building out your system it may be useful to state the group types on startup. For example:
let assert Ok(registry) = registry.start()
let registry: process.Subject(registry.Message(String, User))
By specifying the types we can document the kind of registry we are working with; in the example above we can tell we’re creating different “users” with unique stringified names.
pub opaque type Message(name, msg)
Functions
pub fn find(
registry: Subject(Message(a, b)),
name: a,
) -> Result(Subject(b), Nil)
Looks up a uniquely named Subject
.
Example
> registry.find(registry, "my-subject")
Ok(subject)
pub fn register(
registry: Subject(Message(a, b)),
subject: Subject(b),
name: a,
) -> Nil
Registers a Subject
under a unique name.
Example
> registry.register(registry, process.new_subject(), "my-subject")
Nil