tobogganSe connecter

packages

The Louise packages, each released on its own

Clone avec HTTPS, un jeton personnel en mot de passe, ou avec SSH, une clé ajoutée dans vos paramètres.

Examples: the event store on PostgreSQL (issue #145's example)

`examples/event_store`: the DDD discussion end to end.

- **Aggregates are pure**: `counter.lse`'s `decide`/`evolve`; the command
  handler's flow (load, evolve, decide, append) performs the
  `event_store` effect — memory in tests, PostgreSQL in production, and
  domain code sees only its port.
- **The port and its two handlers** (`lib.lse`): `event_store` with
  `load`/`append`; `with_memory` (a region and a dict) and
  `with_postgres` (each operation its own transaction on the pool).
- **Optimistic concurrency**: appends insert at their version with the
  head checked in the same statement (`insert ... select ... where`);
  a moved head inserts nothing and a race's loser meets the
  `(stream, version)` primary key — both become `Error(Conflict)`.
- **The outbox**: events and outbox rows are written in one transaction,
  with `pg_notify('event_store_events', stream)`; `projection.lse`'s
  delivery actor listens (the driver's `pg.listen`) and applies
  unpublished rows to the `stream_counts` projection in one transaction,
  marking them published — a failed drain leaves rows for the next
  notification.

Tests: the in-memory handler and the aggregate everywhere; on PostgreSQL
(`LOUISE_PG_URL`): migrate, append, load, a stale-writer conflict, and
the projection catching up through LISTEN/NOTIFY. The example is in CI
(scripts/ci.sh), skipping the live parts without a database.

olivier · il y a 1 mois · a567f7b4d7e03449df33c585bbddbbd566214fbd

Parents 1a4c877

1 fichiers modifiés, 6 ajouts, 0 suppressions