Skip to content

Commit c67979f

Browse files
committed
Rename prefix cache match
1 parent d6556ed commit c67979f

File tree

4 files changed

+13
-13
lines changed

4 files changed

+13
-13
lines changed

pkg/epp/datalayer/plugins/data_types.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,25 +21,25 @@ import (
2121
)
2222

2323
const (
24-
PrefixCacheMatchPrecentKey = "PrefixCacheMatchPercentKey"
24+
PrefixCacheMatchInfoKey = "PrefixCacheMatchInfoKey"
2525
)
2626

27-
type PrefixCacheMatchPercent struct {
27+
type PrefixCacheMatchInfo struct {
2828
matchPercentage float64
2929
}
3030

31-
func NewPrefixCacheMatchPercent(matchPercentage float64) *PrefixCacheMatchPercent {
32-
return &PrefixCacheMatchPercent{
31+
func NewPrefixCacheMatchInfo(matchPercentage float64) *PrefixCacheMatchInfo {
32+
return &PrefixCacheMatchInfo{
3333
matchPercentage: matchPercentage,
3434
}
3535
}
3636

37-
func (p *PrefixCacheMatchPercent) MatchPercentage() float64 {
37+
func (p *PrefixCacheMatchInfo) MatchPercentage() float64 {
3838
return p.matchPercentage
3939
}
4040

41-
func (p *PrefixCacheMatchPercent) Clone() datalayer.Cloneable {
42-
return &PrefixCacheMatchPercent{
41+
func (p *PrefixCacheMatchInfo) Clone() datalayer.Cloneable {
42+
return &PrefixCacheMatchInfo{
4343
matchPercentage: p.matchPercentage,
4444
}
4545
}

pkg/epp/scheduling/framework/plugins/multi/prefix/plugin.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,7 +208,7 @@ func (p *Plugin) WithName(name string) *Plugin {
208208
}
209209

210210
func (p *Plugin) Produces() map[string]any {
211-
return map[string]any{dplugins.PrefixCacheMatchPrecentKey: dplugins.PrefixCacheMatchPercent{}}
211+
return map[string]any{dplugins.PrefixCacheMatchInfoKey: dplugins.PrefixCacheMatchInfo{}}
212212
}
213213

214214
func (p *Plugin) Consumes() map[string]any {
@@ -236,7 +236,7 @@ func (p *Plugin) PrepareRequestData(ctx context.Context, request *types.LLMReque
236236
return float64(matchLen) / float64(total)
237237
}
238238
for _, pod := range pods {
239-
pod.Put(dplugins.PrefixCacheMatchPrecentKey, dplugins.NewPrefixCacheMatchPercent(podScoreFunc(pod)))
239+
pod.Put(dplugins.PrefixCacheMatchInfoKey, dplugins.NewPrefixCacheMatchInfo(podScoreFunc(pod)))
240240
}
241241
return nil
242242
}

pkg/epp/scheduling/framework/plugins/scorer/prefix_cache_match_scorer.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,12 +74,12 @@ func (s *PrefixCacheScorer) Score(_ context.Context, cycleState *types.CycleStat
7474
scores := make(map[types.Pod]float64, len(pods))
7575

7676
for _, pod := range pods {
77-
matchPercent, ok := pod.Get(dplugins.PrefixCacheMatchPrecentKey)
77+
matchPercent, ok := pod.Get(dplugins.PrefixCacheMatchInfoKey)
7878
if !ok {
7979
scores[pod] = 0.0
8080
continue
8181
}
82-
scores[pod] = matchPercent.(*dplugins.PrefixCacheMatchPercent).MatchPercentage()
82+
scores[pod] = matchPercent.(*dplugins.PrefixCacheMatchInfo).MatchPercentage()
8383
}
8484
return scores
8585
}

pkg/epp/scheduling/framework/plugins/scorer/prefix_cache_match_scorer_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,10 @@ func (p *mockPod) Keys() []string {
7070

7171
func TestPrefixCacheScorer_Score(t *testing.T) {
7272
pod1 := newMockPod()
73-
pod1.Put(dplugins.PrefixCacheMatchPrecentKey, dplugins.NewPrefixCacheMatchPercent(50.0))
73+
pod1.Put(dplugins.PrefixCacheMatchInfoKey, dplugins.NewPrefixCacheMatchInfo(50.0))
7474

7575
pod2 := newMockPod()
76-
pod2.Put(dplugins.PrefixCacheMatchPrecentKey, dplugins.NewPrefixCacheMatchPercent(100.0))
76+
pod2.Put(dplugins.PrefixCacheMatchInfoKey, dplugins.NewPrefixCacheMatchInfo(100.0))
7777

7878
pod3 := newMockPod()
7979

0 commit comments

Comments
 (0)