Files
galaxy-game/lobby/internal/ports/gapactivationstore.go
T
2026-04-25 23:20:55 +02:00

27 lines
1.1 KiB
Go

package ports
import (
"context"
"time"
"galaxy/lobby/internal/domain/common"
)
// GapActivationStore records the moment a game's gap window opens —
// when approved_count first reaches max_players. The enrollment
// automation worker reads the timestamp to decide when start_gap_hours
// have elapsed; approveapplication and redeeminvite are the writers.
type GapActivationStore interface {
// MarkActivated records at as the gap window activation time for
// gameID iff no prior activation exists. A second call for the same
// game is a silent no-op so retries after partial failures stay
// safe. Implementations use SETNX semantics under the hood.
MarkActivated(ctx context.Context, gameID common.GameID, at time.Time) error
// Get returns the previously recorded gap-window activation time for
// gameID. The second return value is false when no activation has
// been recorded yet; in that case the time.Time is the zero value.
// An error is returned only for technical failures.
Get(ctx context.Context, gameID common.GameID) (time.Time, bool, error)
}