Skip to content

Commit 32b6328

Browse files
committed
refactor: registry alias
1 parent ce9a8a5 commit 32b6328

Some content is hidden

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

45 files changed

+78
-87
lines changed

cmd/regup/app/update.go

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

1717
"github.com/stacklok/toolhive/pkg/container/verifier"
1818
"github.com/stacklok/toolhive/pkg/logger"
19-
regtypes "github.com/stacklok/toolhive/pkg/registry/types"
19+
regtypes "github.com/stacklok/toolhive/pkg/registry/registry"
2020
)
2121

2222
var (

cmd/regup/app/update_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/stretchr/testify/require"
1111

1212
"github.com/stacklok/toolhive/pkg/logger"
13-
regtypes "github.com/stacklok/toolhive/pkg/registry/types"
13+
regtypes "github.com/stacklok/toolhive/pkg/registry/registry"
1414
)
1515

1616
//nolint:paralleltest // This test manages temporary directories and cannot run in parallel

cmd/thv-operator/pkg/validation/image_validation.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"sigs.k8s.io/controller-runtime/pkg/client"
1414

1515
mcpv1alpha1 "github.com/stacklok/toolhive/cmd/thv-operator/api/v1alpha1"
16-
regtypes "github.com/stacklok/toolhive/pkg/registry/types"
16+
regtypes "github.com/stacklok/toolhive/pkg/registry/registry"
1717
)
1818

1919
// Sentinel errors for image validation.

cmd/thv-operator/pkg/validation/image_validation_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import (
1313
"sigs.k8s.io/controller-runtime/pkg/client/fake"
1414

1515
mcpv1alpha1 "github.com/stacklok/toolhive/cmd/thv-operator/api/v1alpha1"
16-
regtypes "github.com/stacklok/toolhive/pkg/registry/types"
16+
regtypes "github.com/stacklok/toolhive/pkg/registry/registry"
1717
)
1818

1919
func TestAlwaysAllowValidator(t *testing.T) {

cmd/thv-proxyrunner/app/run.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ import (
1111
"github.com/stacklok/toolhive/pkg/container"
1212
"github.com/stacklok/toolhive/pkg/container/runtime"
1313
"github.com/stacklok/toolhive/pkg/logger"
14-
regtypes "github.com/stacklok/toolhive/pkg/registry/types"
14+
regtypes "github.com/stacklok/toolhive/pkg/registry/registry"
1515
"github.com/stacklok/toolhive/pkg/runner"
1616
"github.com/stacklok/toolhive/pkg/workloads"
1717
)

cmd/thv/app/group.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import (
1616
"github.com/stacklok/toolhive/pkg/core"
1717
"github.com/stacklok/toolhive/pkg/groups"
1818
"github.com/stacklok/toolhive/pkg/registry"
19-
"github.com/stacklok/toolhive/pkg/registry/types"
19+
types "github.com/stacklok/toolhive/pkg/registry/registry"
2020
"github.com/stacklok/toolhive/pkg/runner/retriever"
2121
"github.com/stacklok/toolhive/pkg/transport"
2222
"github.com/stacklok/toolhive/pkg/validation"

cmd/thv/app/registry.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
"github.com/spf13/cobra"
1111

1212
"github.com/stacklok/toolhive/pkg/registry"
13-
"github.com/stacklok/toolhive/pkg/registry/types"
13+
types "github.com/stacklok/toolhive/pkg/registry/registry"
1414
transtypes "github.com/stacklok/toolhive/pkg/transport/types"
1515
)
1616

cmd/thv/app/run_flags.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import (
2020
"github.com/stacklok/toolhive/pkg/logger"
2121
"github.com/stacklok/toolhive/pkg/networking"
2222
"github.com/stacklok/toolhive/pkg/process"
23-
regtypes "github.com/stacklok/toolhive/pkg/registry/types"
23+
regtypes "github.com/stacklok/toolhive/pkg/registry/registry"
2424
"github.com/stacklok/toolhive/pkg/runner"
2525
"github.com/stacklok/toolhive/pkg/runner/retriever"
2626
"github.com/stacklok/toolhive/pkg/telemetry"

cmd/thv/app/search.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
"github.com/spf13/cobra"
1010

1111
"github.com/stacklok/toolhive/pkg/registry"
12-
"github.com/stacklok/toolhive/pkg/registry/types"
12+
types "github.com/stacklok/toolhive/pkg/registry/registry"
1313
)
1414

1515
var searchCmd = &cobra.Command{

pkg/api/v1/registry.go

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

1010
"github.com/stacklok/toolhive/pkg/config"
1111
"github.com/stacklok/toolhive/pkg/logger"
12-
"github.com/stacklok/toolhive/pkg/registry"
13-
"github.com/stacklok/toolhive/pkg/registry/types"
12+
regpkg "github.com/stacklok/toolhive/pkg/registry"
13+
"github.com/stacklok/toolhive/pkg/registry/registry"
1414
)
1515

1616
const (
@@ -59,8 +59,8 @@ func getRegistryInfoWithProvider(configProvider config.Provider) (RegistryType,
5959
}
6060

6161
// getCurrentProvider returns the current registry provider using the injected config
62-
func (rr *RegistryRoutes) getCurrentProvider(w http.ResponseWriter) (registry.Provider, bool) {
63-
provider, err := registry.GetDefaultProviderWithConfig(rr.configProvider)
62+
func (rr *RegistryRoutes) getCurrentProvider(w http.ResponseWriter) (regpkg.Provider, bool) {
63+
provider, err := regpkg.GetDefaultProviderWithConfig(rr.configProvider)
6464
if err != nil {
6565
http.Error(w, "Failed to get registry provider", http.StatusInternalServerError)
6666
logger.Errorf("Failed to get registry provider: %v", err)
@@ -256,7 +256,7 @@ func (rr *RegistryRoutes) updateRegistry(w http.ResponseWriter, r *http.Request)
256256
}
257257

258258
// Reset the default provider to pick up configuration changes
259-
registry.ResetDefaultProvider()
259+
regpkg.ResetDefaultProvider()
260260

261261
response := UpdateRegistryResponse{
262262
Message: message,
@@ -401,8 +401,8 @@ func (rr *RegistryRoutes) listServers(w http.ResponseWriter, r *http.Request) {
401401

402402
// Build response with both container and remote servers
403403
response := listServersResponse{
404-
Servers: make([]*types.ImageMetadata, 0, len(reg.Servers)),
405-
RemoteServers: make([]*types.RemoteServerMetadata, 0, len(reg.RemoteServers)),
404+
Servers: make([]*registry.ImageMetadata, 0, len(reg.Servers)),
405+
RemoteServers: make([]*registry.RemoteServerMetadata, 0, len(reg.RemoteServers)),
406406
}
407407

408408
// Add container servers
@@ -460,14 +460,14 @@ func (rr *RegistryRoutes) getServer(w http.ResponseWriter, r *http.Request) {
460460
// Build response based on server type
461461
var response getServerResponse
462462
if server.IsRemote() {
463-
if remote, ok := server.(*types.RemoteServerMetadata); ok {
463+
if remote, ok := server.(*registry.RemoteServerMetadata); ok {
464464
response = getServerResponse{
465465
RemoteServer: remote,
466466
IsRemote: true,
467467
}
468468
}
469469
} else {
470-
if img, ok := server.(*types.ImageMetadata); ok {
470+
if img, ok := server.(*registry.ImageMetadata); ok {
471471
response = getServerResponse{
472472
Server: img,
473473
IsRemote: false,
@@ -528,27 +528,27 @@ type getRegistryResponse struct {
528528
// Source of the registry (URL, file path, or empty string for built-in)
529529
Source string `json:"source"`
530530
// Full registry data
531-
Registry *types.Registry `json:"registry"`
531+
Registry *registry.Registry `json:"registry"`
532532
}
533533

534534
// listServersResponse represents the response for listing servers in a registry
535535
//
536536
// @Description Response containing a list of servers
537537
type listServersResponse struct {
538538
// List of container servers in the registry
539-
Servers []*types.ImageMetadata `json:"servers"`
539+
Servers []*registry.ImageMetadata `json:"servers"`
540540
// List of remote servers in the registry (if any)
541-
RemoteServers []*types.RemoteServerMetadata `json:"remote_servers,omitempty"`
541+
RemoteServers []*registry.RemoteServerMetadata `json:"remote_servers,omitempty"`
542542
}
543543

544544
// getServerResponse represents the response for getting a server from a registry
545545
//
546546
// @Description Response containing server details
547547
type getServerResponse struct {
548548
// Container server details (if it's a container server)
549-
Server *types.ImageMetadata `json:"server,omitempty"`
549+
Server *registry.ImageMetadata `json:"server,omitempty"`
550550
// Remote server details (if it's a remote server)
551-
RemoteServer *types.RemoteServerMetadata `json:"remote_server,omitempty"`
551+
RemoteServer *registry.RemoteServerMetadata `json:"remote_server,omitempty"`
552552
// Indicates if this is a remote server
553553
IsRemote bool `json:"is_remote"`
554554
}

0 commit comments

Comments
 (0)