package console import ( "context" "time" "github.com/carlosframework/platform/internal/boxchoice" "github.com/carlosframework/platform/internal/hostactors" "github.com/carlosframework/platform/internal/hostops" ) // executorChooser is create's executor choice (region HA §5.2, L8) over // console's live edges read and the claim listing's loads. // ConfigureClaimRuntime binds it as the create door's // hostops.ProductionAuthority.Executors (stage B Task 10). With // Config.RegionHA off it is nil, and the create path is today's (spec §8 // step 2: dormant). func (s *Server) executorChooser(d hostactors.Directory) *hostops.ExecutorChooser { if !s.cfg.RegionHA { return nil } return &hostops.ExecutorChooser{Directory: d, Edges: func(ctx context.Context) (boxchoice.Snapshot, error) { snap, err := s.liveEdges(ctx) if err != nil { return boxchoice.Snapshot{}, err } return boxSnapshot(snap), nil }, Loads: func(ctx context.Context) (map[string]boxchoice.Load, error) { return hostops.ClaimLoads(ctx, s.cfg.Releases) }, // HomeName is the create door's home binding, the one // ProductionAuthority.HomeRegion holds (dbClaimHomeRegion). SecretsKeyFP: s.expectedSecretsFP(), HomeName: s.cfg.dbClaimHomeRegion(), Now: time.Now} }