package store import ( "context" "database/sql" "time" "github.com/cosmic-clash/cosmic-clash/server/domain" ) // AllocatingMatchClaims adapts the PostgreSQL lease boundary for allocator // workers without making the allocator package depend on the store package. type AllocatingMatchClaims struct { DB *sql.DB Transport string } func (s AllocatingMatchClaims) ClaimAllocatingMatch(ctx context.Context, now time.Time) (domain.AllocationRequest, bool, error) { item, found, err := ClaimAllocatingMatch(ctx, s.DB, s.Transport, now) return item.Request, found, err } func (s AllocatingMatchClaims) FindProviderAllocation(ctx context.Context, request domain.AllocationRequest) (domain.Allocation, bool, error) { return FindProviderAllocation(ctx, s.DB, request) } func (s AllocatingMatchClaims) BindAllocatedMatch(ctx context.Context, allocation domain.Allocation) error { return BindAllocatedMatch(ctx, s.DB, allocation) } // AllocationRegistry adapts provider-allocation reconciliation for allocator // workers. A successful provider response is not publishable until this store // boundary records the same compatibility tuple and GameServer identity. type AllocationRegistry struct{ DB *sql.DB } func (s AllocationRegistry) RecordProviderAllocation(ctx context.Context, allocation domain.Allocation, now time.Time) (domain.Allocation, error) { return RecordProviderAllocation(ctx, s.DB, allocation, now) }