feat: gate allocator roster publication

This commit is contained in:
Josh Creek
2026-09-01 09:55:09 +01:00
parent 8b5b5333c6
commit febc69bdef
5 changed files with 49 additions and 4 deletions
+15
View File
@@ -18,12 +18,27 @@ type Durable interface {
RecordProviderAllocation(context.Context, domain.Allocation, time.Time) (domain.Allocation, error)
}
type RosterPublisher interface {
PublishRoster(context.Context, domain.Assignment, []domain.SignedJoinAuthorisation, func([]byte, []byte) bool) error
}
type Service struct {
Provider Provider
Durable Durable
Roster RosterPublisher
Now func() time.Time
}
func (s Service) PublishRoster(ctx context.Context, assignment domain.Assignment, roster []domain.SignedJoinAuthorisation, verify func([]byte, []byte) bool) error {
if s.Roster == nil {
return errNotConfigured
}
if assignment.Allocation.State != domain.ServerAllocated || assignment.Endpoint == "" {
return domain.ErrManifestRejected
}
return s.Roster.PublishRoster(ctx, assignment, roster, verify)
}
func (s Service) Allocate(ctx context.Context, request domain.AllocationRequest, labels map[string]string) (agones.AllocatedServer, error) {
if s.Provider == nil || s.Durable == nil || s.Now == nil {
return agones.AllocatedServer{}, errNotConfigured