Skip to content

Commit f3f582a

Browse files
committed
Updated for the newer GIE
Signed-off-by: irar2 <irar@il.ibm.com>
1 parent 55996a2 commit f3f582a

File tree

5 files changed

+18
-18
lines changed

5 files changed

+18
-18
lines changed

pkg/plugins/datalayer/models/datasource_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ import (
88

99
"github.com/stretchr/testify/assert"
1010
"k8s.io/apimachinery/pkg/types"
11-
1211
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datalayer"
1312
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datalayer/http"
13+
fwkdl "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/framework/interface/datalayer"
1414
)
1515

1616
func TestDatasource(t *testing.T) {
@@ -36,8 +36,8 @@ func TestDatasource(t *testing.T) {
3636
assert.Nil(t, err, "failed to register")
3737

3838
ctx := context.Background()
39-
factory := datalayer.NewEndpointFactory([]datalayer.DataSource{source}, 100*time.Millisecond)
40-
pod := &datalayer.EndpointMetadata{
39+
factory := datalayer.NewEndpointFactory([]fwkdl.DataSource{source}, 100*time.Millisecond)
40+
pod := &fwkdl.EndpointMetadata{
4141
NamespacedName: types.NamespacedName{
4242
Name: "pod1",
4343
Namespace: "default",

pkg/plugins/datalayer/models/extractor.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ import (
66
"reflect"
77
"strings"
88

9-
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datalayer"
10-
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
9+
fwkdl "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/framework/interface/datalayer"
10+
fwkplugin "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/framework/interface/plugin"
1111
)
1212

1313
const modelsAttributeKey = "/v1/models"
@@ -27,7 +27,7 @@ func (m *ModelInfo) String() string {
2727
}
2828

2929
// Clone returns a full copy of the object
30-
func (m ModelInfoCollection) Clone() datalayer.Cloneable {
30+
func (m ModelInfoCollection) Clone() fwkdl.Cloneable {
3131
if m == nil {
3232
return nil
3333
}
@@ -60,21 +60,21 @@ var (
6060

6161
// ModelExtractor implements the models extraction.
6262
type ModelExtractor struct {
63-
typedName plugins.TypedName
63+
typedName fwkplugin.TypedName
6464
}
6565

6666
// NewModelExtractor returns a new model extractor.
6767
func NewModelExtractor() (*ModelExtractor, error) {
6868
return &ModelExtractor{
69-
typedName: plugins.TypedName{
69+
typedName: fwkplugin.TypedName{
7070
Type: ModelsExtractorType,
7171
Name: ModelsExtractorType,
7272
},
7373
}, nil
7474
}
7575

7676
// TypedName returns the type and name of the ModelExtractor.
77-
func (me *ModelExtractor) TypedName() plugins.TypedName {
77+
func (me *ModelExtractor) TypedName() fwkplugin.TypedName {
7878
return me.typedName
7979
}
8080

@@ -85,12 +85,12 @@ func (me *ModelExtractor) ExpectedInputType() reflect.Type {
8585

8686
// Extract transforms the data source output into a concrete attribute that
8787
// is stored on the given endpoint.
88-
func (me *ModelExtractor) Extract(_ context.Context, data any, ep datalayer.Endpoint) error {
88+
func (me *ModelExtractor) Extract(_ context.Context, data any, ep fwkdl.Endpoint) error {
8989
models, ok := data.(*ModelResponse)
9090
if !ok {
9191
return fmt.Errorf("unexpected input in Extract: %T", data)
9292
}
9393

94-
ep.Put(modelsAttributeKey, ModelInfoCollection(models.Data))
94+
ep.GetAttributes().Put(modelsAttributeKey, ModelInfoCollection(models.Data))
9595
return nil
9696
}

pkg/plugins/datalayer/models/extractor_test.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66

77
"github.com/google/go-cmp/cmp"
88

9-
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datalayer"
9+
fwkdl "sigs.k8s.io/gateway-api-inference-extension/pkg/epp/framework/interface/datalayer"
1010
)
1111

1212
func TestExtractorExtract(t *testing.T) {
@@ -29,7 +29,7 @@ func TestExtractorExtract(t *testing.T) {
2929
t.Errorf("incorrect expected input type: %v", inputType)
3030
}
3131

32-
ep := datalayer.NewEndpoint(nil, nil)
32+
ep := fwkdl.NewEndpoint(nil, nil)
3333
if ep == nil {
3434
t.Fatal("expected non-nil endpoint")
3535
}

pkg/plugins/datalayer/models/factories.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"io"
77

88
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/datalayer/http"
9-
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/plugins"
9+
"sigs.k8s.io/gateway-api-inference-extension/pkg/epp/framework/interface/plugin"
1010
)
1111

1212
const (
@@ -28,7 +28,7 @@ type modelsDatasourceParams struct {
2828

2929
// ModelDataSourceFactory is a factory function used to instantiate data layer's
3030
// models data source plugins specified in a configuration.
31-
func ModelDataSourceFactory(name string, parameters json.RawMessage, _ plugins.Handle) (plugins.Plugin, error) {
31+
func ModelDataSourceFactory(name string, parameters json.RawMessage, _ plugin.Handle) (plugin.Plugin, error) {
3232
cfg := defaultDataSourceConfigParams()
3333
if parameters != nil { // overlay the defaults with configured values
3434
if err := json.Unmarshal(parameters, cfg); err != nil {
@@ -43,7 +43,7 @@ func ModelDataSourceFactory(name string, parameters json.RawMessage, _ plugins.H
4343

4444
// ModelServerExtractorFactory is a factory function used to instantiate data layer's models
4545
// Extractor plugins specified in a configuration.
46-
func ModelServerExtractorFactory(name string, _ json.RawMessage, _ plugins.Handle) (plugins.Plugin, error) {
46+
func ModelServerExtractorFactory(name string, _ json.RawMessage, _ plugin.Handle) (plugin.Plugin, error) {
4747
extractor, err := NewModelExtractor()
4848
if err != nil {
4949
return nil, err

pkg/plugins/register.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ func RegisterAllPlugins() {
2323
plugin.Register(scorer.SessionAffinityType, scorer.SessionAffinityFactory)
2424
plugin.Register(scorer.ActiveRequestType, scorer.ActiveRequestFactory)
2525
plugin.Register(scorer.NoHitLRUType, scorer.NoHitLRUFactory)
26-
plugins.Register(models.ModelsDataSourceType, models.ModelDataSourceFactory)
27-
plugins.Register(models.ModelsExtractorType, models.ModelServerExtractorFactory)
26+
plugin.Register(models.ModelsDataSourceType, models.ModelDataSourceFactory)
27+
plugin.Register(models.ModelsExtractorType, models.ModelServerExtractorFactory)
2828
}

0 commit comments

Comments
 (0)