github.com/juju/juju@v0.0.0-20240430160146-1752b71fcf00/docker/registry/internal/interface.go (about) 1 // Copyright 2021 Canonical Ltd. 2 // Licensed under the AGPLv3, see LICENCE file for details. 3 4 package internal 5 6 import ( 7 "time" 8 9 "github.com/juju/juju/docker" 10 "github.com/juju/juju/tools" 11 ) 12 13 //go:generate go run go.uber.org/mock/mockgen -package mocks -destination mocks/registry_mock.go github.com/juju/juju/docker/registry/internal Initializer 14 15 // Registry provides APIs to interact with the OCI provider client. 16 type Registry interface { 17 String() string 18 Tags(string) (tools.Versions, error) 19 GetArchitecture(imageName, tag string) (string, error) 20 Close() error 21 Ping() error 22 ImageRepoDetails() docker.ImageRepoDetails 23 ShouldRefreshAuth() (bool, time.Duration) 24 RefreshAuth() error 25 } 26 27 // RegistryInternal provides methods of registry clients for internal operations. 28 // It's exported for generating mocks for tests. 29 type RegistryInternal interface { 30 Matcher 31 Registry 32 Initializer 33 } 34 35 // Matcher provides a method for selecting which registry client to use. 36 type Matcher interface { 37 Match() bool 38 } 39 40 // Initializer provides methods for initializing the registry client. 41 type Initializer interface { 42 WrapTransport(...TransportWrapper) error 43 DecideBaseURL() error 44 }