Skip to content

Commit df31112

Browse files
committed
docs(store): describe PostgreSQL consistency and integration checks
1 parent 175ac27 commit df31112

1 file changed

Lines changed: 24 additions & 3 deletions

File tree

‎crates/adapters/gfa-store/README.md‎

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# SQLite match persistence
1+
# Match persistence
22

33
`SqliteMatchStore` implements the storage port in `gfa-service`. Inject an
44
`Arc<SqliteMatchStore>` into the lifecycle service when wiring a host.
@@ -31,5 +31,26 @@ python3 .github/scripts/sqlite-query-check.py verify
3131
```
3232

3333
When a query is removed, also remove its obsolete `.sqlx/query-*.json` file.
34-
This adapter stores the initial match event model; searchable metadata,
35-
retention policies, snapshots, and PostgreSQL support are separate increments.
34+
## PostgreSQL
35+
36+
Enable the `postgres` feature and connect with
37+
`PostgresMatchStore::connect(url).await`. The pool applies the embedded
38+
`migrations/postgres` migrations at startup. Use a dedicated database and include
39+
`sslmode=verify-full` for a remote database. Call `close().await` on shutdown.
40+
41+
PostgreSQL appends lock the match row before checking receipts and revisions.
42+
Snapshot reads use a repeatable-read transaction; assist counters use atomic
43+
upserts. Match IDs have C collation so cursor ordering agrees with the service.
44+
The SQLite and PostgreSQL adapters implement the same storage port.
45+
46+
The PostgreSQL CI job compiles queries against a fresh migration-derived schema,
47+
checks the committed PostgreSQL metadata, and runs the ignored integration test
48+
against a separate empty database. To run it locally, set `DATABASE_URL` to a
49+
migrated query-checking database and `GFA_TEST_POSTGRES_URL` to an isolated empty
50+
test database, then run:
51+
52+
```sh
53+
cargo test -p gfa-store --no-default-features --features postgres --locked -- --ignored
54+
```
55+
56+
Retention policies and materialized replay snapshots are separate increments.

0 commit comments

Comments
 (0)