Files
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

84 lines
4.4 KiB
Go

// Code generated by sqlc. DO NOT EDIT.
// versions:
// sqlc v1.30.0
package sqlc
import (
"context"
"anchorage/internal/pkg/ids"
)
type Querier interface {
AddMembership(ctx context.Context, arg AddMembershipParams) error
AddTokenDenylist(ctx context.Context, arg AddTokenDenylistParams) error
CreateAPIToken(ctx context.Context, arg CreateAPITokenParams) (ApiToken, error)
CreateOrg(ctx context.Context, arg CreateOrgParams) (Org, error)
CreatePin(ctx context.Context, arg CreatePinParams) (Pin, error)
DecRefcount(ctx context.Context, arg DecRefcountParams) (int32, error)
DeletePin(ctx context.Context, arg DeletePinParams) error
DeleteRefcount(ctx context.Context, arg DeleteRefcountParams) error
DrainNode(ctx context.Context, id ids.NodeID) error
// FilterPins honors the full IPFS Pinning API spec filter surface.
//
// All filters are optional; empty arrays / NULL values short-circuit to
// "no restriction" via the IS NULL / array-length guards. Name matching
// supports four modes through a single `match` discriminator:
//
// 'exact' — LIKE (case-sensitive, no wildcards)
// 'iexact' — ILIKE anchored both ends
// 'partial' — LIKE %name%
// 'ipartial' — ILIKE %name% (uses pg_trgm GIN)
//
// `meta` is treated as a jsonb "contains" check — the pin's meta must
// be a superset of the requested map.
//
FilterPins(ctx context.Context, arg FilterPinsParams) ([]Pin, error)
GetAPITokenByJTI(ctx context.Context, jti ids.TokenID) (ApiToken, error)
GetExistingLivePinByCID(ctx context.Context, arg GetExistingLivePinByCIDParams) (Pin, error)
GetNode(ctx context.Context, id ids.NodeID) (Node, error)
GetOrgByID(ctx context.Context, id ids.OrgID) (Org, error)
GetOrgBySlug(ctx context.Context, slug string) (Org, error)
GetPin(ctx context.Context, arg GetPinParams) (Pin, error)
GetPlacement(ctx context.Context, arg GetPlacementParams) (PinPlacement, error)
GetUserByEmail(ctx context.Context, email string) (User, error)
GetUserByID(ctx context.Context, id ids.UserID) (User, error)
IncRefcount(ctx context.Context, arg IncRefcountParams) error
InsertAudit(ctx context.Context, arg InsertAuditParams) error
InsertPlacement(ctx context.Context, arg InsertPlacementParams) (PinPlacement, error)
IsTokenDenied(ctx context.Context, jti string) (bool, error)
ListAPITokensForUser(ctx context.Context, arg ListAPITokensForUserParams) ([]ApiToken, error)
ListAllNodes(ctx context.Context) ([]Node, error)
ListAudit(ctx context.Context, arg ListAuditParams) ([]AuditLog, error)
ListLiveNodes(ctx context.Context) ([]Node, error)
ListMemberships(ctx context.Context, userID ids.UserID) ([]ListMembershipsRow, error)
ListOrgs(ctx context.Context, arg ListOrgsParams) ([]Org, error)
ListPins(ctx context.Context, arg ListPinsParams) ([]Pin, error)
ListPlacementsForNode(ctx context.Context, arg ListPlacementsForNodeParams) ([]PinPlacement, error)
ListPlacementsForPin(ctx context.Context, requestID ids.PinID) ([]ListPlacementsForPinRow, error)
MarkNodeDown(ctx context.Context, id ids.NodeID) error
MarkStaleNodesDown(ctx context.Context, secs float64) ([]ids.NodeID, error)
PromoteSysadmin(ctx context.Context, id ids.UserID) error
PruneTokenDenylist(ctx context.Context) error
RemoveMembership(ctx context.Context, arg RemoveMembershipParams) error
// ReplacePin swaps a pin's CID atomically. Used by POST /v1/pins/{rid}
// (pin replace per spec). Placements + refcount are left to the caller
// to rearrange in the same transaction.
//
ReplacePin(ctx context.Context, arg ReplacePinParams) (Pin, error)
ReplacePlacementFence(ctx context.Context, arg ReplacePlacementFenceParams) (PinPlacement, error)
RevokeAPIToken(ctx context.Context, jti ids.TokenID) error
StuckPlacements(ctx context.Context, secs float64) ([]StuckPlacementsRow, error)
TouchAPITokenLastUsed(ctx context.Context, jti ids.TokenID) error
TouchNodeHeartbeat(ctx context.Context, id ids.NodeID) error
UncordonNode(ctx context.Context, id ids.NodeID) error
UpdateOrgName(ctx context.Context, arg UpdateOrgNameParams) (Org, error)
UpdatePinStatus(ctx context.Context, arg UpdatePinStatusParams) error
UpdatePlacementStatusFenced(ctx context.Context, arg UpdatePlacementStatusFencedParams) (int64, error)
UpsertNode(ctx context.Context, arg UpsertNodeParams) (Node, error)
UpsertUserByAuthentikSub(ctx context.Context, arg UpsertUserByAuthentikSubParams) (User, error)
}
var _ Querier = (*Queries)(nil)