chip/registry

This is a local process registry that individually tags Subjects for later reference.

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
pub fn start() -> Result(Subject(Message(a, b)), StartError)

Starts the registry.

Example

> registry.start()
Ok(registry)
Search Document