Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func ExtractHost ¶
ExtractHost extracts the registry host from an image name Examples:
- "r8.im/user/model" -> "r8.im"
- "ghcr.io/owner/repo:tag" -> "ghcr.io"
- "gcr.io/project/image" -> "gcr.io"
- "docker.io/library/nginx" -> "docker.io"
- "nginx" -> "docker.io" (Docker Hub default)
- "myregistry.com:5000/image" -> "myregistry.com:5000"
- "localhost:5000/image" -> "localhost:5000"
func RegisterProvider ¶
func RegisterProvider(p Provider)
RegisterProvider adds a provider to the default registry This should be called from init() functions in provider packages
Types ¶
type LoginOptions ¶
type Provider ¶
type Provider interface {
// Name returns the provider identifier (e.g., "replicate", "generic")
Name() string
// MatchesRegistry returns true if this provider handles the given registry host
MatchesRegistry(host string) bool
// Login performs provider-specific authentication
Login(ctx context.Context, opts LoginOptions) error
// PostPush is called after push attempt (success or failure)
// - Shows success message (e.g., Replicate model URL)
// - May transform errors into provider-specific messages
// - pushErr is nil on success, contains the push error on failure
PostPush(ctx context.Context, opts PushOptions, pushErr error) error
}
Provider encapsulates registry-specific behavior
type PushOptions ¶
PushOptions contains all options for a push operation
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages provider lookup and registration
func DefaultRegistry ¶
func DefaultRegistry() *Registry
DefaultRegistry returns the global provider registry, initializing it on first call The registry is pre-populated with Replicate and Generic providers
func NewRegistry ¶
func NewRegistry() *Registry
NewRegistry creates a new Registry with no providers registered
func (*Registry) ForHost ¶
ForHost returns the provider for a given registry host Returns the first provider that matches, or nil if none match