feat: runtime manager

This commit is contained in:
Ilia Denisov
2026-04-28 20:39:18 +02:00
committed by GitHub
parent e0a99b346b
commit a7cee15115
289 changed files with 45660 additions and 2207 deletions
+45 -4
View File
@@ -118,6 +118,24 @@ const (
// Game Lobby when capability evaluation at game finish releases a
// reservation because the member did not meet the capability rule.
NotificationTypeLobbyRaceNameRegistrationDenied NotificationType = "lobby.race_name.registration_denied"
// NotificationTypeRuntimeImagePullFailed identifies the
// `runtime.image_pull_failed` administrator notification published by
// Runtime Manager when the engine image cannot be pulled during a
// start operation.
NotificationTypeRuntimeImagePullFailed NotificationType = "runtime.image_pull_failed"
// NotificationTypeRuntimeContainerStartFailed identifies the
// `runtime.container_start_failed` administrator notification published
// by Runtime Manager when `docker create` or `docker start` returns an
// error during a start operation.
NotificationTypeRuntimeContainerStartFailed NotificationType = "runtime.container_start_failed"
// NotificationTypeRuntimeStartConfigInvalid identifies the
// `runtime.start_config_invalid` administrator notification published by
// Runtime Manager when start configuration validation fails (invalid
// `image_ref`, missing Docker network, unwritable state directory).
NotificationTypeRuntimeStartConfigInvalid NotificationType = "runtime.start_config_invalid"
)
// String returns the wire value for notificationType.
@@ -142,7 +160,10 @@ func (notificationType NotificationType) IsKnown() bool {
NotificationTypeLobbyInviteExpired,
NotificationTypeLobbyRaceNameRegistrationEligible,
NotificationTypeLobbyRaceNameRegistered,
NotificationTypeLobbyRaceNameRegistrationDenied:
NotificationTypeLobbyRaceNameRegistrationDenied,
NotificationTypeRuntimeImagePullFailed,
NotificationTypeRuntimeContainerStartFailed,
NotificationTypeRuntimeStartConfigInvalid:
return true
default:
return false
@@ -170,6 +191,10 @@ func (notificationType NotificationType) ExpectedProducer() Producer {
NotificationTypeLobbyRaceNameRegistered,
NotificationTypeLobbyRaceNameRegistrationDenied:
return ProducerGameLobby
case NotificationTypeRuntimeImagePullFailed,
NotificationTypeRuntimeContainerStartFailed,
NotificationTypeRuntimeStartConfigInvalid:
return ProducerRuntimeManager
default:
return ""
}
@@ -180,7 +205,10 @@ func (notificationType NotificationType) SupportsAudience(audienceKind AudienceK
switch notificationType {
case NotificationTypeGeoReviewRecommended,
NotificationTypeGameGenerationFailed,
NotificationTypeLobbyRuntimePausedAfterStart:
NotificationTypeLobbyRuntimePausedAfterStart,
NotificationTypeRuntimeImagePullFailed,
NotificationTypeRuntimeContainerStartFailed,
NotificationTypeRuntimeStartConfigInvalid:
return audienceKind == AudienceKindAdminEmail
case NotificationTypeLobbyApplicationSubmitted:
return audienceKind == AudienceKindUser || audienceKind == AudienceKindAdminEmail
@@ -195,7 +223,10 @@ func (notificationType NotificationType) SupportsChannel(audienceKind AudienceKi
switch notificationType {
case NotificationTypeGeoReviewRecommended,
NotificationTypeGameGenerationFailed,
NotificationTypeLobbyRuntimePausedAfterStart:
NotificationTypeLobbyRuntimePausedAfterStart,
NotificationTypeRuntimeImagePullFailed,
NotificationTypeRuntimeContainerStartFailed,
NotificationTypeRuntimeStartConfigInvalid:
return audienceKind == AudienceKindAdminEmail && channel == ChannelEmail
case NotificationTypeLobbyApplicationSubmitted:
if audienceKind == AudienceKindAdminEmail {
@@ -222,6 +253,9 @@ const (
// ProducerGameLobby identifies Game Lobby.
ProducerGameLobby Producer = "game_lobby"
// ProducerRuntimeManager identifies Runtime Manager.
ProducerRuntimeManager Producer = "runtime_manager"
)
// String returns the wire value for producer.
@@ -232,7 +266,7 @@ func (producer Producer) String() string {
// IsKnown reports whether producer belongs to the frozen producer set.
func (producer Producer) IsKnown() bool {
switch producer {
case ProducerGeoProfile, ProducerGameMaster, ProducerGameLobby:
case ProducerGeoProfile, ProducerGameMaster, ProducerGameLobby, ProducerRuntimeManager:
return true
default:
return false
@@ -801,6 +835,13 @@ func validatePayloadObject(notificationType NotificationType, payload map[string
return validateStringFields(payload, "race_name")
case NotificationTypeLobbyRaceNameRegistrationDenied:
return validateStringFields(payload, "game_id", "game_name", "race_name", "reason")
case NotificationTypeRuntimeImagePullFailed,
NotificationTypeRuntimeContainerStartFailed,
NotificationTypeRuntimeStartConfigInvalid:
if err := validateStringFields(payload, "game_id", "image_ref", "error_code", "error_message"); err != nil {
return err
}
return validatePositiveIntFields(payload, "attempted_at_ms")
default:
return fmt.Errorf("payload_json notification type %q is unsupported", notificationType)
}