package host import ( "github.com/carlosframework/platform/internal/cgroup" "github.com/carlosframework/platform/internal/registry" "github.com/carlosframework/platform/internal/release" ) // memTier builds the exec backend's Tier seam from a manifest reader โ€” // on a box, stagedManifestOfLiveVersion, the same reader the caps pass // uses, so "what does this app declare" has one answer on the box. // // One bit decides it: capabilities.children โ†’ the 1G tier a forking family // gets on the unit path (caps/render.go); anything else โ†’ 512M, the // carlos-app@ template's number. A missing or unreadable sibling is the // default tier, not an error: the smaller cap is the safe direction, and // the caps pass already reports the unreadable sibling in its own advice. func memTier(load func(registry.Route) (*release.Manifest, error)) func(registry.Route) cgroup.Limit { return func(rt registry.Route) cgroup.Limit { m, err := load(rt) if err != nil || m == nil || m.Capabilities == nil || !m.Capabilities.Children { return cgroup.TierDefault } return cgroup.TierChildren } } // memTierOf is memTier for one named version: that version's staged // manifest, never the live link's (zero-downtime spec ยง7.3: a generation's // limits are its own artifact's). A staged copy is immutable once anything // refers to it (plan 4), so the answer for a version does not move. func memTierOf(load func(rt registry.Route, version string) (*release.Manifest, error)) func(registry.Route, string) cgroup.Limit { return func(rt registry.Route, version string) cgroup.Limit { return memTier(func(rt registry.Route) (*release.Manifest, error) { return load(rt, version) })(rt) } }