Documentation
¶
Index ¶
- type Provider
- func (p *Provider) DefaultRegistrar(globalDefaultName string) (registry.KRegistrar, error)
- func (p *Provider) Discoveries() (map[string]registry.KDiscovery, error)
- func (p *Provider) Discovery(name string) (registry.KDiscovery, error)
- func (p *Provider) Initialize(cfg *discoveryv1.Discoveries, opts ...options.Option)
- func (p *Provider) RegisterDiscovery(name string, discovery registry.KDiscovery)
- func (p *Provider) RegisterRegistrar(name string, registrar registry.KRegistrar)
- func (p *Provider) Registrar(name string) (registry.KRegistrar, error)
- func (p *Provider) Registrars() (map[string]registry.KRegistrar, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Provider ¶
type Provider struct {
// contains filtered or unexported fields
}
Provider manages the lifecycle of discovery and registrar instances. It uses lazy-loading with sync.Once to ensure instances are created only when needed and in a concurrency-safe manner.
func NewProvider ¶
func NewProvider(logger runtimelog.Logger) *Provider
NewProvider creates a new, uninitialized Provider instance.
func (*Provider) DefaultRegistrar ¶
func (p *Provider) DefaultRegistrar(globalDefaultName string) (registry.KRegistrar, error)
DefaultRegistrar returns the default service registrar.
func (*Provider) Discoveries ¶
func (p *Provider) Discoveries() (map[string]registry.KDiscovery, error)
Discoveries returns a map of all available discovery clients. On the first call, it lazily creates and caches instances based on the configuration. Any errors during creation are captured and returned on every subsequent call.
func (*Provider) Discovery ¶
func (p *Provider) Discovery(name string) (registry.KDiscovery, error)
Discovery returns a single discovery client by name.
func (*Provider) Initialize ¶
func (p *Provider) Initialize(cfg *discoveryv1.Discoveries, opts ...options.Option)
Initialize configures the provider with the necessary configuration and options. This method is lightweight and only stores the provided values. It does not perform any instance creation.
func (*Provider) RegisterDiscovery ¶
func (p *Provider) RegisterDiscovery(name string, discovery registry.KDiscovery)
RegisterDiscovery allows for manual registration of a discovery instance.
func (*Provider) RegisterRegistrar ¶
func (p *Provider) RegisterRegistrar(name string, registrar registry.KRegistrar)
RegisterRegistrar allows for manual registration of a registrar instance.
func (*Provider) Registrar ¶
func (p *Provider) Registrar(name string) (registry.KRegistrar, error)
Registrar returns a single service registrar by name.
func (*Provider) Registrars ¶
func (p *Provider) Registrars() (map[string]registry.KRegistrar, error)
Registrars returns a map of all available service registrars. It follows the same lazy-loading and caching logic as Discoveries.