import { Capability, CapabilityRequirement, JobRequirements, NodeInventory } from "./types"; /** * Free capacity available for placement. `(totalCapacity * utilizationCap) * - reservedCapacity`. Can be negative if the node is over-allocated; * placement should treat negative values as "no room". * * @public */ export declare function freeCapacity(inv: NodeInventory): number; /** @public */ export declare function freeCores(inv: NodeInventory): number; /** * Fraction (0-1) of the node's total capacity currently reserved. * Used by the bin-pack scoring strategy. * * @public */ export declare function usedCapacityFraction(inv: NodeInventory): number; /** * Free count of the capability subset a requirement names: total across * every advertised entry matching the requirement's attributes, minus * every reservation not provably disjoint from them. The overlap rule is * deliberately conservative — a reservation whose attributes share no key * with the query could have consumed any entry, so it subtracts. Placement * may under-place on heterogeneous partial attribute sets; it never * double-books a device. * * @public */ export declare function freeCapabilityFor(inv: NodeInventory, req: CapabilityRequirement): number; /** The host sockets already claimed on a node, as a set of canonical * `PORT/proto` tokens. @public */ export declare function reservedHostPortSet(inv: NodeInventory): Set; /** The capability a worker advertises when its job socket is listening; * the handover strategy cannot run without it. A FACILITY, not a resource: * every instance on the worker shares the one listener, so a job requiring * it must match it but never consume it — reserving the worker's single * count would let exactly one handover-capable job onto each worker. * * @public */ export declare const JOB_SOCKET_CAPABILITY = "norsk.io/job-socket"; /** * One placed job's claim on a node: its typed requirements plus the GPU * device placement chose for it (`PlacementResult.gpuIndex`), when it * needs one and the device is known. A GPU claim with no index cannot be * attributed to a device and reserves none. * * @public */ export interface PlacedClaim { requirements: JobRequirements; gpuIndex?: number; } /** @public */ export interface GpuReservation { index: number; reservedCapacity: number; } /** What `deriveReservation` sums. @public */ export interface DerivedReservation { capacity: number; cores: number; capabilities: Capability[]; hostPorts: string[]; /** Per device index, only devices with a claim on them. */ gpus: GpuReservation[]; } /** * Sum a set of placed jobs' claims into a node reservation — the single * derivation AutoManager overlays onto wire inventory (which arrives with * zeroed reservation fields today). Capability reservations preserve the * requirement's attribute filter, so an identity-bound claim ("decklink * cardIndex 0") blocks that card and not its siblings; host ports union * into the claimed-socket set; GPU capacity is attributed to the device * each job was placed on. * * @public */ export declare function deriveReservation(claims: PlacedClaim[]): DerivedReservation; /** * Overlay a derived reservation onto a wire inventory, deferring to a * non-zero wire value — if a producer ever advertises real reservations * they are authoritative. Per GPU device the same rule: a device the wire * reports as reserved (any capacity, or exclusively) is kept; otherwise * the derived capacity is written on, and a device the claims fill * (reserved >= totalCapacity) is `exclusivelyReserved` — the whole-GPU * job of the `GpuResource` doc. * * @public */ export declare function overlayReservation(inv: NodeInventory, reservation: DerivedReservation): NodeInventory; //# sourceMappingURL=inventory.d.ts.map