@@ -19,23 +19,24 @@ import (
1919 "container/heap"
2020 "fmt"
2121 "k8s.io/client-go/tools/cache"
22+ arbv1 "github.com/project-codeflare/multi-cluster-app-dispatcher/pkg/apis/controller/v1beta1"
2223)
2324
2425// Below is the implementation of the a heap. The logic is pretty much the same
2526// as cache.heap, however, this heap does not perform synchronization. It leaves
2627// synchronization to the SchedulingQueue.
2728
28- type LessFunc func (interface {}, interface {} ) bool
29+ type LessFunc func (qj1 , qj2 * arbv1. AppWrapper ) bool
2930type KeyFunc func (obj interface {}) (string , error )
3031
3132type heapItem struct {
32- obj interface {} // The object which is stored in the heap.
33+ obj * arbv1. AppWrapper // The object which is stored in the heap.
3334 index int // The index of the object's key in the Heap.queue.
3435}
3536
3637type itemKeyValue struct {
3738 key string
38- obj interface {}
39+ obj * arbv1. AppWrapper
3940}
4041
4142// heapData is an internal struct that implements the standard heap interface
@@ -121,7 +122,7 @@ type Heap struct {
121122
122123// Add inserts an item, and puts it in the queue. The item is updated if it
123124// already exists.
124- func (h * Heap ) Add (obj interface {} ) error {
125+ func (h * Heap ) Add (obj * arbv1. AppWrapper ) error {
125126 key , err := h .data .keyFunc (obj )
126127 if err != nil {
127128 return cache.KeyError {Obj : obj , Err : err }
@@ -136,7 +137,7 @@ func (h *Heap) Add(obj interface{}) error {
136137}
137138
138139// BulkAdd adds all the items in the list to the queue.
139- func (h * Heap ) BulkAdd (list []interface {} ) error {
140+ func (h * Heap ) BulkAdd (list []* arbv1. AppWrapper ) error {
140141 for _ , obj := range list {
141142 key , err := h .data .keyFunc (obj )
142143 if err != nil {
@@ -154,7 +155,7 @@ func (h *Heap) BulkAdd(list []interface{}) error {
154155
155156// AddIfNotPresent inserts an item, and puts it in the queue. If an item with
156157// the key is present in the map, no changes is made to the item.
157- func (h * Heap ) AddIfNotPresent (obj interface {} ) error {
158+ func (h * Heap ) AddIfNotPresent (obj * arbv1. AppWrapper ) error {
158159 key , err := h .data .keyFunc (obj )
159160 if err != nil {
160161 return cache.KeyError {Obj : obj , Err : err }
@@ -167,7 +168,7 @@ func (h *Heap) AddIfNotPresent(obj interface{}) error {
167168
168169// Update is the same as Add in this implementation. When the item does not
169170// exist, it is added.
170- func (h * Heap ) Update (obj interface {} ) error {
171+ func (h * Heap ) Update (obj * arbv1. AppWrapper ) error {
171172 return h .Add (obj )
172173}
173174
0 commit comments