e03c328792
* nomad/state/state_store: CSIVolumesByNodeID ignores namespace * scheduler/scheduler: add CSIVolumesByNodeID to the state interface * scheduler/feasible: check node MaxVolumes * nomad/csi_endpoint: no namespace inn CSIVolumesByNodeID anymore * nomad/state/state_store: avoid DenormalizeAllocationSlice * nomad/state/iterator: clean up SliceIterator Next * scheduler/feasible_test: block with MaxVolumes * nomad/state/state_store_test: fix args to CSIVolumesByNodeID
32 lines
475 B
Go
32 lines
475 B
Go
package state
|
|
|
|
type SliceIterator struct {
|
|
data []interface{}
|
|
idx int
|
|
}
|
|
|
|
func NewSliceIterator() *SliceIterator {
|
|
return &SliceIterator{
|
|
data: []interface{}{},
|
|
idx: 0,
|
|
}
|
|
}
|
|
|
|
func (i *SliceIterator) Add(datum interface{}) {
|
|
i.data = append(i.data, datum)
|
|
}
|
|
|
|
func (i *SliceIterator) Next() interface{} {
|
|
if i.idx == len(i.data) {
|
|
return nil
|
|
}
|
|
|
|
datum := i.data[i.idx]
|
|
i.idx += 1
|
|
return datum
|
|
}
|
|
|
|
func (i *SliceIterator) WatchCh() <-chan struct{} {
|
|
return nil
|
|
}
|