Skip to content

Commit 2c30f77

Browse files
committed
feat: extract shared infrastructure into internal/platform layer
Signed-off-by: Alessio Pragliola <seth.pro@gmail.com>
1 parent 5f890cd commit 2c30f77

318 files changed

Lines changed: 3561 additions & 3551 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitattributes

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -226,22 +226,22 @@ internal/converter/generated/embedmd_openapi_converter.gen.go linguist-generated
226226
internal/converter/generated/openapi_converter.gen.go linguist-generated=true
227227
internal/converter/generated/openapi_embedmd_converter.gen.go linguist-generated=true
228228
internal/converter/generated/openapi_reconciler.gen.go linguist-generated=true
229-
internal/db/schema/artifact.gen.go linguist-generated=true
230-
internal/db/schema/artifactproperty.gen.go linguist-generated=true
231-
internal/db/schema/association.gen.go linguist-generated=true
232-
internal/db/schema/attribution.gen.go linguist-generated=true
233-
internal/db/schema/context.gen.go linguist-generated=true
234-
internal/db/schema/contextproperty.gen.go linguist-generated=true
235-
internal/db/schema/event.gen.go linguist-generated=true
236-
internal/db/schema/eventpath.gen.go linguist-generated=true
237-
internal/db/schema/execution.gen.go linguist-generated=true
238-
internal/db/schema/executionproperty.gen.go linguist-generated=true
239-
internal/db/schema/mlmdenv.gen.go linguist-generated=true
240-
internal/db/schema/parentcontext.gen.go linguist-generated=true
241-
internal/db/schema/parenttype.gen.go linguist-generated=true
242-
internal/db/schema/schema_migrations.gen.go linguist-generated=true
243-
internal/db/schema/type.gen.go linguist-generated=true
244-
internal/db/schema/typeproperty.gen.go linguist-generated=true
229+
internal/platform/db/schema/artifact.gen.go linguist-generated=true
230+
internal/platform/db/schema/artifactproperty.gen.go linguist-generated=true
231+
internal/platform/db/schema/association.gen.go linguist-generated=true
232+
internal/platform/db/schema/attribution.gen.go linguist-generated=true
233+
internal/platform/db/schema/context.gen.go linguist-generated=true
234+
internal/platform/db/schema/contextproperty.gen.go linguist-generated=true
235+
internal/platform/db/schema/event.gen.go linguist-generated=true
236+
internal/platform/db/schema/eventpath.gen.go linguist-generated=true
237+
internal/platform/db/schema/execution.gen.go linguist-generated=true
238+
internal/platform/db/schema/executionproperty.gen.go linguist-generated=true
239+
internal/platform/db/schema/mlmdenv.gen.go linguist-generated=true
240+
internal/platform/db/schema/parentcontext.gen.go linguist-generated=true
241+
internal/platform/db/schema/parenttype.gen.go linguist-generated=true
242+
internal/platform/db/schema/schema_migrations.gen.go linguist-generated=true
243+
internal/platform/db/schema/type.gen.go linguist-generated=true
244+
internal/platform/db/schema/typeproperty.gen.go linguist-generated=true
245245
internal/server/openapi/api.go linguist-generated=true
246246
internal/server/openapi/api_model_registry_service.go linguist-generated=true
247247
internal/server/openapi/error.go linguist-generated=true

Makefile

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,14 +120,14 @@ stop/postgres:
120120
.PHONY: gen/gorm/mysql
121121
gen/gorm/mysql: bin/golang-migrate start/mysql
122122
@(trap 'cd $(CURDIR) && $(MAKE) stop/mysql' EXIT; \
123-
$(GOLANG_MIGRATE) -path './internal/datastore/embedmd/mysql/migrations' -database 'mysql://root:root@tcp(localhost:3306)/model-registry' up && \
123+
$(GOLANG_MIGRATE) -path './internal/platform/db/mysql/migrations' -database 'mysql://root:root@tcp(localhost:3306)/model-registry' up && \
124124
cd gorm-gen && GOWORK=off go run main.go --db-type mysql --dsn 'root:root@tcp(localhost:3306)/model-registry?charset=utf8mb4&parseTime=True&loc=Local')
125125

126126
# generate the gorm structs for PostgreSQL
127127
.PHONY: gen/gorm/postgres
128128
gen/gorm/postgres: bin/golang-migrate start/postgres
129129
@(trap 'cd $(CURDIR) && $(MAKE) stop/postgres' EXIT; \
130-
$(GOLANG_MIGRATE) -path './internal/datastore/embedmd/postgres/migrations' -database 'postgres://postgres:postgres@localhost:5432/model-registry?sslmode=disable' up && \
130+
$(GOLANG_MIGRATE) -path './internal/platform/db/postgres/migrations' -database 'postgres://postgres:postgres@localhost:5432/model-registry?sslmode=disable' up && \
131131
cd gorm-gen && GOWORK=off go run main.go --db-type postgres --dsn 'postgres://postgres:postgres@localhost:5432/model-registry?sslmode=disable' && \
132132
cd $(CURDIR) && ./scripts/remove_gorm_defaults.sh)
133133

@@ -144,9 +144,10 @@ endif
144144
.PHONY: vet
145145
vet:
146146
@echo "Running go vet on all packages..."
147-
@${GO} vet $$(${GO} list ./... | grep -vF github.com/kubeflow/hub/internal/db/filter) && \
148-
echo "Checking filter package (parser.go excluded due to participle struct tags)..." && \
149-
cd internal/db/filter && ${GO} build -o /dev/null . 2>&1 | grep -E "vet:|error:" || echo "✓ Filter package builds successfully"
147+
@${GO} vet $$(${GO} list ./... | grep -vE 'github.com/kubeflow/hub/internal/(db|platform/db)/filter') && \
148+
echo "Checking filter packages (parser.go excluded due to participle struct tags)..." && \
149+
cd internal/db/filter && ${GO} build -o /dev/null . 2>&1 | grep -E "vet:|error:" || echo "✓ Filter package builds successfully" && \
150+
cd $(CURDIR)/internal/platform/db/filter && ${GO} build -o /dev/null . 2>&1 | grep -E "vet:|error:" || echo "✓ Platform filter package builds successfully"
150151

151152
.PHONY: clean/csi
152153
clean/csi:

catalog/cmd/catalog.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,9 @@ import (
1919
"github.com/kubeflow/hub/catalog/internal/db/service"
2020
"github.com/kubeflow/hub/catalog/internal/leader"
2121
"github.com/kubeflow/hub/catalog/internal/server/openapi"
22-
"github.com/kubeflow/hub/internal/datastore"
22+
"github.com/kubeflow/hub/internal/platform/datastore"
2323
"github.com/kubeflow/hub/internal/datastore/embedmd"
24-
"github.com/kubeflow/hub/internal/db"
24+
"github.com/kubeflow/hub/internal/platform/db"
2525
"github.com/spf13/cobra"
2626
"golang.org/x/sync/errgroup"
2727
)

catalog/internal/catalog/basecatalog/common_properties.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package basecatalog
33
import (
44
"maps"
55

6-
"github.com/kubeflow/hub/internal/db/filter"
6+
"github.com/kubeflow/hub/internal/platform/db/filter"
77
)
88

99
// CommonContextProperties returns the entity-table properties shared by all Context entities.

catalog/internal/catalog/basecatalog/entity_registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import (
44
"strings"
55
"sync"
66

7-
"github.com/kubeflow/hub/internal/db/filter"
7+
"github.com/kubeflow/hub/internal/platform/db/filter"
88
)
99

1010
// EntityTypeDefinition describes a single catalog entity type's filtering behavior.

catalog/internal/catalog/basecatalog/entity_registry_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ package basecatalog
33
import (
44
"testing"
55

6-
"github.com/kubeflow/hub/internal/db/filter"
6+
"github.com/kubeflow/hub/internal/platform/db/filter"
77
"github.com/stretchr/testify/assert"
88
"github.com/stretchr/testify/require"
99
)

catalog/internal/catalog/basecatalog/filter_options.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import (
55

66
sharedmodels "github.com/kubeflow/hub/catalog/internal/db/models"
77
apimodels "github.com/kubeflow/hub/catalog/pkg/openapi"
8-
"github.com/kubeflow/hub/internal/apiutils"
8+
"github.com/kubeflow/hub/internal/platform/apiutils"
99
)
1010

1111
// DbPropToAPIOption converts a database PropertyOption to an API FilterOption.

catalog/internal/catalog/basecatalog/source_status.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
mapset "github.com/deckarep/golang-set/v2"
77
"github.com/golang/glog"
88
dbmodels "github.com/kubeflow/hub/catalog/internal/db/models"
9-
mrmodels "github.com/kubeflow/hub/internal/db/models"
9+
mrmodels "github.com/kubeflow/hub/internal/platform/db/entity"
1010
)
1111

1212
// CleanupOrphanedCatalogSources removes CatalogSource records for sources that are no

catalog/internal/catalog/mcpcatalog/db_mcp.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
sharedmodels "github.com/kubeflow/hub/catalog/internal/db/models"
1212
"github.com/kubeflow/hub/catalog/internal/db/service"
1313
openapi "github.com/kubeflow/hub/catalog/pkg/openapi"
14-
"github.com/kubeflow/hub/internal/apiutils"
14+
"github.com/kubeflow/hub/internal/platform/apiutils"
1515
"github.com/kubeflow/hub/pkg/api"
1616
)
1717

catalog/internal/catalog/mcpcatalog/db_mcp_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import (
88
"github.com/kubeflow/hub/catalog/internal/catalog/basecatalog"
99
"github.com/kubeflow/hub/catalog/internal/catalog/mcpcatalog/models"
1010
sharedmodels "github.com/kubeflow/hub/catalog/internal/db/models"
11-
internalmodels "github.com/kubeflow/hub/internal/db/models"
11+
internalmodels "github.com/kubeflow/hub/internal/platform/db/entity"
1212
"github.com/kubeflow/hub/pkg/api"
1313
"github.com/stretchr/testify/assert"
1414
"github.com/stretchr/testify/require"

0 commit comments

Comments
 (0)