feat: game lobby service
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
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)
|
||||
}
|
||||
Reference in New Issue
Block a user