carlos / platform Public

Clone
git clone https://amadan.net/carlos/platform

Plain git — no account needed to clone.

Download

Download this file

1package console
2
3import (
4 "context"
5 "time"
6
7 "github.com/carlosframework/platform/internal/boxchoice"
8 "github.com/carlosframework/platform/internal/hostactors"
9 "github.com/carlosframework/platform/internal/hostops"
10)
11
12// executorChooser is create's executor choice (region HA §5.2, L8) over
13// console's live edges read and the claim listing's loads.
14// ConfigureClaimRuntime binds it as the create door's
15// hostops.ProductionAuthority.Executors (stage B Task 10). With
16// Config.RegionHA off it is nil, and the create path is today's (spec §8
17// step 2: dormant).
18func (s *Server) executorChooser(d hostactors.Directory) *hostops.ExecutorChooser {
19 if !s.cfg.RegionHA {
20 return nil
21 }
22 return &hostops.ExecutorChooser{Directory: d,
23 Edges: func(ctx context.Context) (boxchoice.Snapshot, error) {
24 snap, err := s.liveEdges(ctx)
25 if err != nil {
26 return boxchoice.Snapshot{}, err
27 }
28 return boxSnapshot(snap), nil
29 },
30 Loads: func(ctx context.Context) (map[string]boxchoice.Load, error) {
31 return hostops.ClaimLoads(ctx, s.cfg.Releases)
32 },
33 // HomeName is the create door's home binding, the one
34 // ProductionAuthority.HomeRegion holds (dbClaimHomeRegion).
35 SecretsKeyFP: s.expectedSecretsFP(), HomeName: s.cfg.dbClaimHomeRegion(), Now: time.Now}
36}
37