package activator import ( "context" "os/exec" "github.com/carlosframework/platform/internal/cgroup" "github.com/carlosframework/platform/internal/hostwrite" ) func spawnClaimed(ctx context.Context, enabled bool, manager *cgroup.Manager, host string, limit cgroup.Limit, selected hostwrite.Work, identity hostwrite.Identity, build func() *exec.Cmd) (*exec.Cmd, *cgroup.Prepared, error) { return spawnClaimedBefore(ctx, enabled, manager, host, limit, selected, identity, build, nil) } func spawnClaimedBefore(ctx context.Context, enabled bool, manager *cgroup.Manager, host string, limit cgroup.Limit, selected hostwrite.Work, identity hostwrite.Identity, build func() *exec.Cmd, before func() error) (*exec.Cmd, *cgroup.Prepared, error) { if !enabled { cmd, err := manager.Start(host, limit, build) return cmd, nil, err } // Main's isolated root launcher does not yet consume claim reservations. // Keep this old helper closed even if a future caller reintroduces it. return nil, nil, ErrClaimIsolationUnavailable } // spawnClaimedGen is the claims-on spawn of a generation child under the // entry's parent (zero-downtime spec section 7.3), and it is closed: it // pins nothing, reserves nothing, never builds the command and never // enters the host write. Invalid arguments answer hostwrite.ErrUnavailable; // every other call answers ErrClaimIsolationUnavailable, like // spawnClaimedBefore. Main's RoleLaunch.Start is closed too, so routing a // claimed generation spawn there would not open it either. A later plan // needs an isolated root launch protocol that carries the claim // reservations and the final authority check, rather than a re-route or // an in-process path. func spawnClaimedGen(ctx context.Context, parent *cgroup.Prepared, n uint64, tier cgroup.Limit, selected hostwrite.Work, identity hostwrite.Identity, build func() *exec.Cmd, before func() error) (*exec.Cmd, *cgroup.Prepared, error) { if parent == nil || selected == nil || build == nil || n == 0 { return nil, nil, hostwrite.ErrUnavailable } return nil, nil, ErrClaimIsolationUnavailable }