Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions pkg/epp/datalayer/datasource_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,17 +31,17 @@ const (
)

type mockDataSource struct {
tn plugins.TypedName
typedName plugins.TypedName
}

func (m *mockDataSource) TypedName() plugins.TypedName { return m.tn }
func (m *mockDataSource) TypedName() plugins.TypedName { return m.typedName }
func (m *mockDataSource) Extractors() []string { return []string{} }
func (m *mockDataSource) AddExtractor(_ Extractor) error { return nil }
func (m *mockDataSource) Collect(_ context.Context, _ Endpoint) error { return nil }

func TestRegisterAndGetSource(t *testing.T) {
reg := DataSourceRegistry{}
ds := &mockDataSource{tn: plugins.TypedName{Type: testType, Name: testType}}
ds := &mockDataSource{typedName: plugins.TypedName{Type: testType, Name: testType}}

err := reg.Register(ds)
assert.NoError(t, err, "expected no error on first registration")
Expand Down
24 changes: 12 additions & 12 deletions pkg/epp/requestcontrol/director_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -141,19 +141,19 @@ func newMockPrepareDataPlugin(name string) *mockPrepareDataPlugin {
}

type mockAdmissionPlugin struct {
tn plugins.TypedName
typedName plugins.TypedName
denialError error
}

func newMockAdmissionPlugin(name string, denialError error) *mockAdmissionPlugin {
return &mockAdmissionPlugin{
tn: plugins.TypedName{Type: "mock-admit-data", Name: name},
typedName: plugins.TypedName{Type: "mock-admit-data", Name: name},
denialError: denialError,
}
}

func (m *mockAdmissionPlugin) TypedName() plugins.TypedName {
return m.tn
return m.typedName
}

func (m *mockAdmissionPlugin) AdmitRequest(ctx context.Context, request *schedulingtypes.LLMRequest, pods []schedulingtypes.Pod) error {
Expand Down Expand Up @@ -1238,51 +1238,51 @@ const (
)

type testResponseReceived struct {
tn plugins.TypedName
typedName plugins.TypedName
lastRespOnResponse *Response
lastTargetPodOnResponse string
}

type testResponseStreaming struct {
tn plugins.TypedName
typedName plugins.TypedName
lastRespOnStreaming *Response
lastTargetPodOnStreaming string
}

type testResponseComplete struct {
tn plugins.TypedName
typedName plugins.TypedName
lastRespOnComplete *Response
lastTargetPodOnComplete string
}

func newTestResponseReceived(name string) *testResponseReceived {
return &testResponseReceived{
tn: plugins.TypedName{Type: testResponseReceivedType, Name: name},
typedName: plugins.TypedName{Type: testResponseReceivedType, Name: name},
}
}

func newTestResponseStreaming(name string) *testResponseStreaming {
return &testResponseStreaming{
tn: plugins.TypedName{Type: testPostStreamingType, Name: name},
typedName: plugins.TypedName{Type: testPostStreamingType, Name: name},
}
}

func newTestResponseComplete(name string) *testResponseComplete {
return &testResponseComplete{
tn: plugins.TypedName{Type: testPostCompleteType, Name: name},
typedName: plugins.TypedName{Type: testPostCompleteType, Name: name},
}
}

func (p *testResponseReceived) TypedName() plugins.TypedName {
return p.tn
return p.typedName
}

func (p *testResponseStreaming) TypedName() plugins.TypedName {
return p.tn
return p.typedName
}

func (p *testResponseComplete) TypedName() plugins.TypedName {
return p.tn
return p.typedName
}

func (p *testResponseReceived) ResponseReceived(_ context.Context, _ *schedulingtypes.LLMRequest, response *Response, targetPod *backend.Pod) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ import (
)

type SLOAwareRouter struct {
tn plugins.TypedName
typedName plugins.TypedName
latencypredictor latencypredictor.PredictorInterface
runningRequestLists map[types.NamespacedName]*requestPriorityQueue
sloContextStore sync.Map // map[string]*SLORequestContext
Expand Down Expand Up @@ -108,7 +108,7 @@ func NewSLOAwareRouter(config Config, predictor latencypredictor.PredictorInterf
}

return &SLOAwareRouter{
tn: plugins.TypedName{Type: SLOAwareRouterPluginType, Name: SLOAwareRouterPluginType},
typedName: plugins.TypedName{Type: SLOAwareRouterPluginType, Name: SLOAwareRouterPluginType},
latencypredictor: predictor,
runningRequestLists: make(map[types.NamespacedName]*requestPriorityQueue),
sloContextStore: sync.Map{},
Expand All @@ -132,11 +132,11 @@ func startPredictor(handle plugins.Handle) (latencypredictor.PredictorInterface,
}

func (s *SLOAwareRouter) TypedName() plugins.TypedName {
return s.tn
return s.typedName
}

func (s *SLOAwareRouter) WithName(name string) *SLOAwareRouter {
s.tn.Name = name
s.typedName.Name = name
return s
}

Expand Down
8 changes: 4 additions & 4 deletions pkg/epp/scheduling/framework/plugins/scorer/lora_affinity.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,18 @@ func LoraAffinityScorerFactory(name string, _ json.RawMessage, _ plugins.Handle)
// NewLoraAffinityScorer initializes a new LoraAffinityScorer and returns its pointer.
func NewLoraAffinityScorer() *LoraAffinityScorer {
return &LoraAffinityScorer{
tn: plugins.TypedName{Type: LoraAffinityScorerType, Name: LoraAffinityScorerType},
typedName: plugins.TypedName{Type: LoraAffinityScorerType, Name: LoraAffinityScorerType},
}
}

// LoraAffinityScorer scores list of candidate pods based on Lora affinity and availability.
type LoraAffinityScorer struct {
tn plugins.TypedName
typedName plugins.TypedName
}

// TypedName returns the type and name tuple of this plugin instance.
func (s *LoraAffinityScorer) TypedName() plugins.TypedName {
return s.tn
return s.typedName
}

// Consumes returns the list of data that is consumed by the plugin.
Expand All @@ -65,7 +65,7 @@ func (s *LoraAffinityScorer) Consumes() map[string]any {

// WithName sets the name of the scorer.
func (s *LoraAffinityScorer) WithName(name string) *LoraAffinityScorer {
s.tn.Name = name
s.typedName.Name = name
return s
}

Expand Down