Files
anchorage/sqlc.yaml
William Gill 12bf35caf8 anchorage v1.0 initial tree
Greenfield Go multi-tenant IPFS Pinning Service wire-compatible with the
IPFS Pinning Services API spec. Paired 1:1 with Kubo over localhost RPC,
clustered via embedded NATS JetStream, Postgres source-of-truth with
RLS-enforced tenancy, Fiber + huma v2 for the HTTP surface, Authentik
OIDC for session login with kid-rotated HS256 JWT API tokens.

Feature-complete against the 22-milestone build plan, including the
ship-it v1.0 gap items:

  * admin CLIs: drain/uncordon, maintenance, mint-token, rotate-key,
    prune-denylist, rebalance --dry-run, cache-stats, cluster-presences
  * TTL leader election via NATS KV, fence tokens, JetStream dedup
  * rebalancer (plan/apply split), reconciler, requeue sweeper
  * ristretto caches with NATS-backed cross-node invalidation
    (placements live-nodes + token denylist)
  * maintenance watchdog for stuck cluster-pause flag
  * Prometheus /metrics with CIDR ACL, HTTP/pin/scheduler/cache gauges
  * rate limiting: session (10/min) + anonymous global (120/min)
  * integration tests: rebalance, refcount multi-org, RLS belt
  * goreleaser (tar + deb/rpm/apk + Alpine Docker) targeting Gitea

Stack: Cobra/Viper, Fiber v2 + huma v2, embedded NATS JetStream,
pgx/sqlc/golang-migrate, ristretto, TypeID, prometheus/client_golang,
testcontainers-go.
2026-04-16 18:13:36 -05:00

48 lines
2.0 KiB
YAML

version: "2"
sql:
- engine: "postgresql"
queries: "internal/pkg/store/postgres/queries"
schema: "internal/pkg/store/postgres/migrations"
gen:
go:
package: "sqlc"
out: "internal/pkg/store/postgres/sqlc"
sql_package: "pgx/v5"
emit_interface: true
emit_json_tags: false
emit_pointers_for_null_types: true
emit_db_tags: false
overrides:
# TypeID columns: stored as text in Postgres but surfaced as typed
# Go wrappers so Go code cannot mix an OrgID with a PinID.
- column: "orgs.id"
go_type: "anchorage/internal/pkg/ids.OrgID"
- column: "users.id"
go_type: "anchorage/internal/pkg/ids.UserID"
- column: "memberships.org_id"
go_type: "anchorage/internal/pkg/ids.OrgID"
- column: "memberships.user_id"
go_type: "anchorage/internal/pkg/ids.UserID"
- column: "api_tokens.jti"
go_type: "anchorage/internal/pkg/ids.TokenID"
- column: "api_tokens.org_id"
go_type: "anchorage/internal/pkg/ids.OrgID"
- column: "api_tokens.user_id"
go_type: "anchorage/internal/pkg/ids.UserID"
- column: "nodes.id"
go_type: "anchorage/internal/pkg/ids.NodeID"
- column: "pins.request_id"
go_type: "anchorage/internal/pkg/ids.PinID"
- column: "pins.org_id"
go_type: "anchorage/internal/pkg/ids.OrgID"
- column: "pin_placements.request_id"
go_type: "anchorage/internal/pkg/ids.PinID"
- column: "pin_placements.node_id"
go_type: "anchorage/internal/pkg/ids.NodeID"
- column: "pin_refcount.node_id"
go_type: "anchorage/internal/pkg/ids.NodeID"
- column: "audit_log.org_id"
go_type: "anchorage/internal/pkg/ids.OrgID"
- column: "audit_log.actor_user_id"
go_type: "anchorage/internal/pkg/ids.UserID"