feat(multiplayer): persist connection generation leases

This commit is contained in:
Josh Creek
2026-09-03 13:38:13 +01:00
parent 2e9da3032c
commit 3e0022ce9c
10 changed files with 286 additions and 80 deletions
+6 -2
View File
@@ -89,8 +89,12 @@ func ServerShutdownerFromStore(db *sql.DB) ServerShutdowner {
type postgresServerConnections struct{ db *sql.DB }
func (p postgresServerConnections) RecordPlayerConnected(ctx context.Context, binding domain.WorkloadBinding, playerID, idempotencyKey string, now time.Time) error {
return store.RecordPlayerConnected(ctx, p.db, binding, playerID, idempotencyKey, now)
func (p postgresServerConnections) ClaimPlayerConnection(ctx context.Context, binding domain.WorkloadBinding, playerID string, expectedGeneration uint64, idempotencyKey string, now time.Time) (uint64, error) {
return store.ClaimPlayerConnection(ctx, p.db, binding, playerID, expectedGeneration, idempotencyKey, now)
}
func (p postgresServerConnections) RecordPlayerDisconnected(ctx context.Context, binding domain.WorkloadBinding, playerID string, generation uint64, idempotencyKey string, now time.Time) error {
return store.RecordPlayerDisconnected(ctx, p.db, binding, playerID, generation, idempotencyKey, now)
}
func ServerConnectionsFromStore(db *sql.DB) ServerConnectionRecorder {