@@ -555,15 +555,18 @@ schedulingProfiles:
555
555
var _ framework.Filter = & test1 {}
556
556
557
557
type test1 struct {
558
+ tn plugins.TypedName
558
559
Threshold int `json:"threshold"`
559
560
}
560
561
561
- func (f * test1 ) Type () string {
562
- return test1Type
562
+ func newTest1 () * test1 {
563
+ return & test1 {
564
+ tn : plugins.TypedName {Type : test1Type , Name : "test-1" },
565
+ }
563
566
}
564
567
565
- func (f * test1 ) Name () string {
566
- return "test-1"
568
+ func (f * test1 ) TypedName () plugins. TypedName {
569
+ return f . tn
567
570
}
568
571
569
572
// Filter filters out pods that doesn't meet the filter criteria.
@@ -575,14 +578,18 @@ func (f *test1) Filter(_ context.Context, _ *types.CycleState, _ *types.LLMReque
575
578
var _ framework.Scorer = & test2 {}
576
579
var _ framework.PostCycle = & test2 {}
577
580
578
- type test2 struct {}
581
+ type test2 struct {
582
+ tn plugins.TypedName
583
+ }
579
584
580
- func (f * test2 ) Type () string {
581
- return test2Type
585
+ func newTest2 () * test2 {
586
+ return & test2 {
587
+ tn : plugins.TypedName {Type : test2Type , Name : "test-2" },
588
+ }
582
589
}
583
590
584
- func (f * test2 ) Name () string {
585
- return "test-2"
591
+ func (m * test2 ) TypedName () plugins. TypedName {
592
+ return m . tn
586
593
}
587
594
588
595
func (m * test2 ) Score (_ context.Context , _ * types.CycleState , _ * types.LLMRequest , _ []types.Pod ) map [types.Pod ]float64 {
@@ -594,14 +601,18 @@ func (m *test2) PostCycle(_ context.Context, _ *types.CycleState, _ *types.Profi
594
601
// compile-time type validation
595
602
var _ framework.Picker = & testPicker {}
596
603
597
- type testPicker struct {}
604
+ type testPicker struct {
605
+ tn plugins.TypedName
606
+ }
598
607
599
- func (p * testPicker ) Type () string {
600
- return testPickerType
608
+ func newTestPicker () * testPicker {
609
+ return & testPicker {
610
+ tn : plugins.TypedName {Type : testPickerType , Name : "test-picker" },
611
+ }
601
612
}
602
613
603
- func (p * testPicker ) Name () string {
604
- return "test-picker"
614
+ func (p * testPicker ) TypedName () plugins. TypedName {
615
+ return p . tn
605
616
}
606
617
607
618
func (p * testPicker ) Pick (_ context.Context , _ * types.CycleState , _ []* types.ScoredPod ) * types.ProfileRunResult {
@@ -611,14 +622,18 @@ func (p *testPicker) Pick(_ context.Context, _ *types.CycleState, _ []*types.Sco
611
622
// compile-time type validation
612
623
var _ framework.ProfileHandler = & testProfileHandler {}
613
624
614
- type testProfileHandler struct {}
625
+ type testProfileHandler struct {
626
+ tn plugins.TypedName
627
+ }
615
628
616
- func (p * testProfileHandler ) Type () string {
617
- return testProfileHandlerType
629
+ func newTestProfileHandler () * testProfileHandler {
630
+ return & testProfileHandler {
631
+ tn : plugins.TypedName {Type : testProfileHandlerType , Name : "test-profile-handler" },
632
+ }
618
633
}
619
634
620
- func (p * testProfileHandler ) Name () string {
621
- return "test-profile-handler"
635
+ func (p * testProfileHandler ) TypedName () plugins. TypedName {
636
+ return p . tn
622
637
}
623
638
624
639
func (p * testProfileHandler ) Pick (_ context.Context , _ * types.CycleState , _ * types.LLMRequest , _ map [string ]* framework.SchedulerProfile , _ map [string ]* types.ProfileRunResult ) map [string ]* framework.SchedulerProfile {
@@ -631,28 +646,28 @@ func (p *testProfileHandler) ProcessResults(_ context.Context, _ *types.CycleSta
631
646
632
647
func registerTestPlugins () {
633
648
plugins .Register (test1Type ,
634
- func (name string , parameters json.RawMessage , handle plugins.Handle ) (plugins.Plugin , error ) {
635
- result := test1 {}
636
- err := json .Unmarshal (parameters , & result )
637
- return & result , err
649
+ func (_ string , parameters json.RawMessage , _ plugins.Handle ) (plugins.Plugin , error ) {
650
+ result := newTest1 ()
651
+ err := json .Unmarshal (parameters , result )
652
+ return result , err
638
653
},
639
654
)
640
655
641
656
plugins .Register (test2Type ,
642
- func (name string , parameters json.RawMessage , handle plugins.Handle ) (plugins.Plugin , error ) {
643
- return & test2 {} , nil
657
+ func (_ string , _ json.RawMessage , _ plugins.Handle ) (plugins.Plugin , error ) {
658
+ return newTest2 () , nil
644
659
},
645
660
)
646
661
647
662
plugins .Register (testPickerType ,
648
- func (name string , parameters json.RawMessage , handle plugins.Handle ) (plugins.Plugin , error ) {
649
- return & testPicker {} , nil
663
+ func (_ string , _ json.RawMessage , _ plugins.Handle ) (plugins.Plugin , error ) {
664
+ return newTestPicker () , nil
650
665
},
651
666
)
652
667
653
668
plugins .Register (testProfileHandlerType ,
654
- func (name string , parameters json.RawMessage , handle plugins.Handle ) (plugins.Plugin , error ) {
655
- return & testProfileHandler {} , nil
669
+ func (_ string , _ json.RawMessage , _ plugins.Handle ) (plugins.Plugin , error ) {
670
+ return newTestProfileHandler () , nil
656
671
},
657
672
)
658
673
}
0 commit comments