Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
chouzar committed May 10, 2024
1 parent 8ada5b7 commit 2fc9024
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 12 deletions.
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
[![Hex Docs](https://img.shields.io/badge/hex-docs-ffaff3)](https://hexdocs.pm/chip/)


Chip is a gleam process registry that plays along the [Gleam Erlang](https://hexdocs.pm/gleam_erlang/) `Subject` type.
A local process registry that plays along Gleam's [Subject](https://hexdocs.pm/gleam_erlang/gleam/erlang/process.html#Subject) type.

It lets tag subjects under a name or group to later reference them. Will also automatically delist dead processes.

Expand Down Expand Up @@ -67,18 +67,18 @@ pub fn main() {
Later, we may retrieve members for a group:

```gleam
let assert [a, b, c] = group.members(registry, GroupA)
let assert [a, b, c] = group.members(registry, "counters")
let assert 6 = counter.current(a) + counter.current(b) + counter.current(c)
```

Or dispatch a command for each `Subject`::
Or broadcast a message to each Subject:

```gleam
group.dispatch(registry, "counters", fn(counter) {
actor.increment(counter)
})
let assert [a, b, c] = group.members(registry, GroupA)
let assert [a, b, c] = group.members(registry, "counters")
let assert 9 = counter.current(a) + counter.current(b) + counter.current(c)
```

Expand Down
2 changes: 1 addition & 1 deletion gleam.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name = "chip"
version = "0.6.0"
version = "0.6.1"
description = "A Gleam registry library"
licences = ["Apache-2.0"]

Expand Down
8 changes: 4 additions & 4 deletions src/chip/group.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//// This module helps group different `Subject`s under a name to later reference or broadcast messages to them.
//// This is a local process registry that groups Subjects under a name to later reference or broadcast messages to them.

import gleam/dict.{type Dict}
import gleam/erlang/process.{
Expand Down Expand Up @@ -76,7 +76,7 @@ pub fn start() -> Result(Registry(group, msg), actor.StartError) {
))
}

/// Registers a `Subject` under a shared name.
/// Registers a Subject under a shared name.
///
/// ## Example
///
Expand All @@ -92,7 +92,7 @@ pub fn register(
process.send(registry, GroupedRegistrant(subject, group))
}

/// Looks up `Subject`s under a named group.
/// Looks up Subjects under a named group.
///
/// ### Example
///
Expand All @@ -104,7 +104,7 @@ pub fn members(registry, group) -> List(Subject(msg)) {
process.call(registry, GroupedSubjects(_, group), 10)
}

/// Executes a callback for all `Subject`s under a named group.
/// Executes a callback for all Subjects under a named group.
///
/// ### Example
///
Expand Down
6 changes: 3 additions & 3 deletions src/chip/registry.gleam
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//// This module helps tag `Subject`s under a name to later reference them.
//// This is a local process registry that individually tags Subjects for later reference.

import gleam/dict.{type Dict}
import gleam/erlang/process.{
Expand Down Expand Up @@ -63,7 +63,7 @@ pub fn start() -> Result(Registry(name, msg), actor.StartError) {
))
}

/// Registers a `Subject` under a unique name.
/// Registers a Subject under a unique name.
///
/// ## Example
///
Expand All @@ -79,7 +79,7 @@ pub fn register(
process.send(registry, Registrant(subject, name))
}

/// Looks up a uniquely named `Subject`.
/// Looks up a uniquely named Subject.
///
/// ### Example
///
Expand Down

0 comments on commit 2fc9024

Please sign in to comment.