# Gitmirror gitmirror is alternative name of Knotmirror v2. It is designed to be run under the AppView as git syncing service. It currently speaks XRPC, but because it's internal sync service like tap or hydrant, this API interface can change later. ## Database `gitmirror-ingest` mirrors `org.tangled.git.refs` records into postgres. `gitmirror-db` owns the schema; `gitmirror-sync` owns the `state` / `error_msg` / `retry_*` columns it leaves alone. The two run inside `gitmirror serve`, next to the XRPC server. Ingest writes a changed record and puts the row back to `pending`; `gitmirror-sync`'s `BackfillWorker` scans for rows that are behind, fetches, and writes the outcome back. Nothing claims a row in the database: dedup is an in-memory set, the way hydrant does it, so a crash leaves work eligible rather than stuck in a state no reaper clears. Queries are compile-time checked by `sqlx::query!`, and the build has no database, so `gitmirror/crates/gitmirror-db/.sqlx/` is committed and `SQLX_OFFLINE=true` is set in the Containerfile and in `nix/pkgs/gitmirror.nix`. It lives inside the crate rather than at the workspace root because crate2nix builds each crate in isolation. After changing any query: cargo check -p gitmirror-db --all-targets # with the two env vars below SQLX_OFFLINE_DIR=$PWD/gitmirror/crates/gitmirror-db/.sqlx DATABASE_URL=postgres://tnglr:tnglr@localhost:5432/gitmirror Then verify the cache is complete with `DATABASE_URL` unset: SQLX_OFFLINE=true cargo check -p gitmirror --all-targets Embedded hydrant is configured through hydrant's own `HYDRANT_*` environment schema; the collection filter is not among them, since ingest pins it to `org.tangled.git.refs` itself.