Repository: kubernetes/kubernetes
File: staging/src/k8s.io/kube-scheduler/framework/listers.go (Go)

Code before:
// The plugin's default implementation obtains the objects from the API. A different implementation can be
// plugged into the framework in order to simulate the state of DRA objects. For example, Cluster Autoscaler
// can use this to provide the correct DRA object state to the DRA plugin when simulating scheduling changes in-memory.
type SharedDRAManager interface {
	ResourceClaims() ResourceClaimTracker
	ResourceSlices() ResourceSliceLister
	DeviceClasses() DeviceClassLister
	DeviceClassResolver() DeviceClassResolver
}

// CSIManager can be used to obtain CSINode objects, and track changes to CSINode objects in-memory.
// The plugin's default implementation obtains the objects from the API. A different implementation can be
// plugged into the framework in order to simulate the state of CSINode objects. For example, Cluster Autoscaler
// can use this to provide the correct CSINode object state to the CSINode plugin when simulating scheduling changes in-memory.
type CSIManager interface {
	CSINodes() CSINodeLister
}

// WorkloadManager provides an interface for scheduling plugins to provide workload-aware scheduling.
// It acts as the central source of truth for runtime information about workloads.
type WorkloadManager interface {
	// PodGroupState retrieves the runtime state for a specific pod group, identified by workload's namespace and reference.
	PodGroupState(namespace string, workloadRef *v1.WorkloadReference) (PodGroupState, error)
}

// PodGroupInfo provides an interface to view and modify the state of a single pod group.
type PodGroupState interface {
	// AllPods returns the UIDs of all pods known to the scheduler for this group.
	AllPods() sets.Set[types.UID]
	// UnscheduledPods returns all pods that are unscheduled for this group,
	// i.e., are neither assumed nor assigned.
	// The returned map type corresponds to the argument of the PodActivator.Activate method.
	UnscheduledPods() map[string]*v1.Pod
	// AssumedPods returns the UIDs of all pods for this group in the "assumed" state,
	// i.e., passed the Reserve gate.
	AssumedPods() sets.Set[types.UID]
	// AssignedPods returns the UIDs of all pods already assigned (bound) for this group.
	AssignedPods() sets.Set[types.UID]
	// AssumePod marks a pod as having reached the Reserve stage.
	AssumePod(podUID types.UID)
	// ForgetPod removes a pod from the assumed state.
	ForgetPod(podUID types.UID)
	// SchedulingTimeout returns the remaining time until the pod group scheduling times out.
	// A new deadline is created if one doesn't exist, or if the previous one has expired.
	SchedulingTimeout() time.Duration
}


Review comment (suggestion):
```suggestion
// PodGroupState provides an interface to view and modify the state of a single pod group.
```

Code after:
// The plugin's default implementation obtains the objects from the API. A different implementation can be
// plugged into the framework in order to simulate the state of DRA objects. For example, Cluster Autoscaler
// can use this to provide the correct DRA object state to the DRA plugin when simulating scheduling changes in-memory.
type SharedDRAManager interface {
	ResourceClaims() ResourceClaimTracker
	ResourceSlices() ResourceSliceLister
	DeviceClasses() DeviceClassLister
	DeviceClassResolver() DeviceClassResolver
}

// CSIManager can be used to obtain CSINode objects, and track changes to CSINode objects in-memory.
// The plugin's default implementation obtains the objects from the API. A different implementation can be
// plugged into the framework in order to simulate the state of CSINode objects. For example, Cluster Autoscaler
// can use this to provide the correct CSINode object state to the CSINode plugin when simulating scheduling changes in-memory.
type CSIManager interface {
	CSINodes() CSINodeLister
}

// WorkloadManager provides an interface for scheduling plugins to provide workload-aware scheduling.
// It acts as the central source of truth for runtime information about workloads.
type WorkloadManager interface {
	// PodGroupState retrieves the runtime state for a specific pod group, identified by workload's namespace and reference.
	PodGroupState(namespace string, workloadRef *v1.WorkloadReference) (PodGroupState, error)
}

// PodGroupState provides an interface to view and modify the state of a single pod group.
type PodGroupState interface {
	// AllPods returns the UIDs of all pods known to the scheduler for this group.
	AllPods() sets.Set[types.UID]
	// UnscheduledPods returns all pods that are unscheduled for this group,
	// i.e., are neither assumed nor assigned.
	// The returned map type corresponds to the argument of the PodActivator.Activate method.
	UnscheduledPods() map[string]*v1.Pod
	// AssumedPods returns the UIDs of all pods for this group in the "assumed" state,
	// i.e., passed the Reserve gate.
	AssumedPods() sets.Set[types.UID]
	// AssignedPods returns the UIDs of all pods already assigned (bound) for this group.
	AssignedPods() sets.Set[types.UID]
	// AssumePod marks a pod as having reached the Reserve stage.
	AssumePod(podUID types.UID)
	// ForgetPod removes a pod from the assumed state.
	ForgetPod(podUID types.UID)
	// SchedulingTimeout returns the remaining time until the pod group scheduling times out.
	// A new deadline is created if one doesn't exist, or if the previous one has expired.
	SchedulingTimeout() time.Duration
}