@@ -51,15 +51,15 @@ type Datastore interface {
5151
5252 // InferenceModel operations
5353 ModelSetIfOlder (infModel * v1alpha2.InferenceModel ) bool
54- ModelGet (modelName string ) ( * v1alpha2.InferenceModel , bool )
55- ModelDelete (namespacedName types.NamespacedName ) ( * v1alpha2.InferenceModel , bool )
54+ ModelGet (modelName string ) * v1alpha2.InferenceModel
55+ ModelDelete (namespacedName types.NamespacedName ) * v1alpha2.InferenceModel
5656 ModelResync (ctx context.Context , ctrlClient client.Client , modelName string ) (bool , error )
5757 ModelGetAll () []* v1alpha2.InferenceModel
5858
5959 // PodMetrics operations
6060 PodUpdateOrAddIfNotExist (pod * corev1.Pod ) bool
6161 PodUpdateMetricsIfExist (namespacedName types.NamespacedName , m * Metrics ) bool
62- PodGet (namespacedName types.NamespacedName ) ( * PodMetrics , bool )
62+ PodGet (namespacedName types.NamespacedName ) * PodMetrics
6363 PodDelete (namespacedName types.NamespacedName )
6464 PodResyncAll (ctx context.Context , ctrlClient client.Client )
6565 PodGetAll () []* PodMetrics
@@ -147,7 +147,6 @@ func (ds *datastore) PoolLabelsMatch(podLabels map[string]string) bool {
147147 return poolSelector .Matches (podSet )
148148}
149149
150- // /// InferenceModel APIs ///
151150func (ds * datastore ) ModelSetIfOlder (infModel * v1alpha2.InferenceModel ) bool {
152151 ds .poolAndModelsMu .Lock ()
153152 defer ds .poolAndModelsMu .Unlock ()
@@ -199,23 +198,22 @@ func (ds *datastore) ModelResync(ctx context.Context, c client.Client, modelName
199198 return true , nil
200199}
201200
202- func (ds * datastore ) ModelGet (modelName string ) ( * v1alpha2.InferenceModel , bool ) {
201+ func (ds * datastore ) ModelGet (modelName string ) * v1alpha2.InferenceModel {
203202 ds .poolAndModelsMu .RLock ()
204203 defer ds .poolAndModelsMu .RUnlock ()
205- m , exists := ds .models [modelName ]
206- return m , exists
204+ return ds .models [modelName ]
207205}
208206
209- func (ds * datastore ) ModelDelete (namespacedName types.NamespacedName ) ( * v1alpha2.InferenceModel , bool ) {
207+ func (ds * datastore ) ModelDelete (namespacedName types.NamespacedName ) * v1alpha2.InferenceModel {
210208 ds .poolAndModelsMu .Lock ()
211209 defer ds .poolAndModelsMu .Unlock ()
212210 for _ , m := range ds .models {
213211 if m .Name == namespacedName .Name && m .Namespace == namespacedName .Namespace {
214212 delete (ds .models , m .Spec .ModelName )
215- return m , true
213+ return m
216214 }
217215 }
218- return nil , false
216+ return nil
219217}
220218
221219func (ds * datastore ) ModelGetAll () []* v1alpha2.InferenceModel {
@@ -238,12 +236,12 @@ func (ds *datastore) PodUpdateMetricsIfExist(namespacedName types.NamespacedName
238236 return false
239237}
240238
241- func (ds * datastore ) PodGet (namespacedName types.NamespacedName ) ( * PodMetrics , bool ) {
239+ func (ds * datastore ) PodGet (namespacedName types.NamespacedName ) * PodMetrics {
242240 val , ok := ds .pods .Load (namespacedName )
243241 if ok {
244- return val .(* PodMetrics ), true
242+ return val .(* PodMetrics )
245243 }
246- return nil , false
244+ return nil
247245}
248246
249247func (ds * datastore ) PodGetAll () []* PodMetrics {
@@ -311,7 +309,7 @@ func (ds *datastore) PodResyncAll(ctx context.Context, ctrlClient client.Client)
311309 }
312310 }
313311
314- // Remove pods that don't exist or not ready any more.
312+ // Remove pods that don't belong to the pool or not ready any more.
315313 deleteFn := func (k , v any ) bool {
316314 pm := v .(* PodMetrics )
317315 if exist := activePods [pm .NamespacedName .Name ]; ! exist {
0 commit comments