package activator import ( "errors" "github.com/carlosframework/platform/internal/registry" ) // errClaimsNoGenerations refuses a claims-on swap whose claim runtime cannot // start a generation of its own (ClaimRuntime.Generations and Pins). It is // returned before anything is raised, stopped or spawned. var errClaimsNoGenerations = errors.New("swap: claims are on and the claim runtime cannot start a generation of its own") // claimsSwapRefusal is the guard every claims-backed swap (work that is not // hostwrite.Legacy) meets before its side effects: before the admission // runs inside the work, before an overlap raises the parent, before a hold // stops its incumbent (final review F9, index P2-9). On this base it always // refuses. A runtime without Generations and Pins gets // errClaimsNoGenerations, as before. One with both still meets the closed // isolated launch (ErrClaimIsolationUnavailable, as the admission's // refusal: NoOwnership, so the attempt is abandoned, never failed). The // booleans stay for plan 5; they alone never open this guard. // // overlap names the one exception, and it is a test seam: claimSpawn, the // stand-in for a working isolated launch, lets an overlap through to its // claims-on spawn. Only this package's tests set it (no production file // assigns it; TestClaimSpawnIsATestSeam checks that), so production always // refuses here. A hold has no stand-in: its pinned wake would run the // closed claims launch itself, so it is refused even then. func (a *Service) claimsSwapRefusal(overlap bool) error { if r := a.cfg.Claims; r == nil || !r.Generations || !r.Pins { return errClaimsNoGenerations } if overlap && a.claimSpawn != nil { return nil } return claimAdmission(ErrClaimIsolationUnavailable, false) } // claimGenAt is generation n's handle for a claims-on spawn: the generation // sockets where the row has them, and the canonical socket (with a real // number) where it does not. func (a *Service) claimGenAt(rt registry.Route, n uint64) Gen { if gp, ok := a.backend.(genPather); ok { if g, ok := gp.GenPaths(rt, n); ok { return g } } return Gen{N: n, Socket: rt.Socket, Control: rt.Socket + ".control"} }