Current section
Files
Jump to
Current section
Files
README.md
# DGen
[](https://github.com/foundationdb-beam/dgen/actions/workflows/ci.yml)
[](https://github.com/foundationdb-beam/dgen/actions/workflows/formal.yml)
[](https://hex.pm/packages/dgen)
[](https://hexdocs.pm/dgen)
[](LICENSE.md)
DGen provides software building blocks that marry the OTP ethos with a reliable
distributed system, with a focus on **ease of use** and **minimal operator setup**.
We implement a durable and fully distributed `gen_server`-like with `dgen_server`
(Elixir: `DGen.Server`) and a distributed process registry with `dgen_registry`
(Elixir: `DGen.Registry`).
DGen is implemented against the FoundationDB API. Any conforming database could,
in theory, be substituted, but for now FDB is the only implemented backend.
## What's here
- **`dgen_server`** — the `gen_server` programming model (same callbacks, same
return shapes), backed by durable state and a durable message queue instead
of process memory. Any number of processes, on any number of nodes, can
consume from the same server concurrently, and via strict serializability
of FoundationDB, `gen_server` semantics are preserved.
- **`dgen_registry`** — an OTP-compatible process registry: give a running
process a logical name and find or message it by name from anywhere in the
cluster, via the standard `{via, dgen_registry, {RegistryName, LogicalName}}`
contract.
Both are built on the same idea: push state and coordination into a
strongly-consistent backend, so the OTP programming model you already know
keeps working even when a process, a node, or the whole cluster restarts.
## Installation
<!-- tabs-open -->
### Erlang
DGen can be installed by adding `dgen` to your list of dependencies in
`rebar.config`:
```erlang
{deps, [
{dgen, "0.4.x"}
]}.
```
Find the most recent version number on [Hex](https://hex.pm/packages/dgen).
### Elixir
DGen can be installed by adding `dgen` to your list of dependencies in
`mix.exs`:
```elixir
def deps do
[
{:dgen, "~> 0.4"}
]
end
```
<!-- tabs-close -->
## Documentation
- [dgen_server design doc](docs/design/dgen_server_design.md) — programming
model, message processing, locking, persisted state, crash behaviour,
guarantees, and configuration.
- [dgen_registry design doc](docs/design/dgen_registry_design.md) —
consistency model, replication, leadership handoff, guarantees, and
configuration.
- [formal/README.md](formal/README.md) — the TLA+ model of `dgen_registry`'s
replication protocol.
- [test/support/sim/dgen_registry_simulation.md](test/support/sim/dgen_registry_simulation.md)
— deterministic simulation testing of `dgen_registry` against the same invariants, driven by
[`eta`](https://hexdocs.pm/eta).
- API reference and getting-started guides: <https://hexdocs.pm/dgen>.
- [CHANGELOG.md](CHANGELOG.md) — release notes.
## AI full disclosure
- This software is developed with strong assistance from LLMs and with humans
leading the ideas, testing, and debugging. We say this openly because it shaped
how the project was built. If you are not happy with AI-developed code, this
software is not for you. This disclosure was adopted from [antirez/ds4](https://github.com/antirez/ds4).
- We strive to write and edit the documentation for human consumption. LLM-speak
will eventually be rooted out in favor of imperfect human writing. Documentation
generated wholly by LLMs must be annotated as such.