Files
galaxy-game/rtmanager/internal/ports/lobbyinternal.go
T
2026-04-28 20:39:18 +02:00

48 lines
1.9 KiB
Go

package ports
import (
"context"
"errors"
)
// LobbyInternalClient is the synchronous trusted-REST port Runtime
// Manager uses to read ancillary game metadata from Game Lobby. Stage
// 13 calls GetGame purely for diagnostic context; the start envelope
// already carries the only required field (`image_ref`) so a
// LobbyInternalClient failure must not abort the start operation.
type LobbyInternalClient interface {
// GetGame returns the Lobby game record for gameID. It returns
// ErrLobbyGameNotFound when no record exists and ErrLobbyUnavailable
// for transport / timeout / non-2xx responses.
GetGame(ctx context.Context, gameID string) (LobbyGameRecord, error)
}
// LobbyGameRecord stores the subset of the Lobby `GameRecord` schema
// Runtime Manager uses. The shape is intentionally minimal: this fetch
// is ancillary diagnostics and v1 has no required field. The struct
// may be extended additively without breaking existing callers.
type LobbyGameRecord struct {
// GameID identifies the platform game.
GameID string
// Status stores the verbatim Lobby status string (e.g. `starting`,
// `running`, `paused`). Runtime Manager does not interpret it; it
// is exposed for log enrichment and diagnostics only.
Status string
// TargetEngineVersion stores the semver of the engine version Lobby
// resolved into the start envelope's image_ref. Empty when Lobby
// did not return one.
TargetEngineVersion string
}
// ErrLobbyGameNotFound reports that the Lobby internal API returned 404
// for the requested game id.
var ErrLobbyGameNotFound = errors.New("lobby game not found")
// ErrLobbyUnavailable reports that the Lobby internal API could not be
// reached (transport error, timeout, non-2xx response). Callers must
// treat the failure as recoverable: Runtime Manager continues the
// operation when the call is purely diagnostic.
var ErrLobbyUnavailable = errors.New("lobby internal api unavailable")