Documentation
¶
Overview ¶
Package registry implements the functions, types, and contracts for the module.
Package registry contains generated code by adptool.
Package registry implements the functions, types, and contracts for the module.
Index ¶
- Constants
- Variables
- func GetDiscoveries(ctx context.Context, h component.Locator) (map[string]KDiscovery, error)
- func Register(name string, factory Factory)
- func Resolve(ctx context.Context, source any, opts *component.LoadOptions) (*component.ModuleConfig, error)
- func WithRegistrar(r KRegistrar) options.Option
- type Factory
- type KDiscovery
- type KRegistrar
- type KServiceInstance
- type KWatcher
- type Provider
Constants ¶
const ( // CategoryRegistrar is the category for registrar components. CategoryRegistrar component.Category = "registrar" // CategoryDiscovery is the category for discovery components. CategoryDiscovery component.Category = "discovery" )
const Module = "registry"
Variables ¶
var DefaultDiscoveryProvider component.Provider = func(ctx context.Context, h component.Handle) (any, error) { cfg, err := comp.AsConfig[discoveryv1.Discovery](h) if err != nil { return nil, err } return NewDiscovery(cfg) }
DefaultDiscoveryProvider creates instances for service discovery.
var DefaultRegistrarProvider component.Provider = func(ctx context.Context, h component.Handle) (any, error) { cfg, err := comp.AsConfig[discoveryv1.Discovery](h) if err != nil { return nil, err } return NewRegistrar(cfg) }
DefaultRegistrarProvider creates instances for service registration.
var (
ErrRegistryNotFound = runtimeerrors.NewStructured("registry", "registry not found")
)
Functions ¶
func GetDiscoveries ¶ added in v0.2.19
GetDiscoveries collects all discovery instances from the given locator.
func Register ¶ added in v0.2.6
Register registers a new registry factory with the default factory. It is a convenience wrapper around the internal factory's Register method.
func Resolve ¶ added in v0.2.19
func Resolve(ctx context.Context, source any, opts *component.LoadOptions) (*component.ModuleConfig, error)
Resolve resolves the registry configuration.
func WithRegistrar ¶ added in v0.2.13
func WithRegistrar(r KRegistrar) options.Option
WithRegistrar sets the ServerRegistrar for the service.
Types ¶
type Factory ¶ added in v0.1.15
type Factory interface {
NewRegistrar(*discoveryv1.Discovery, ...options.Option) (KRegistrar, error)
NewDiscovery(*discoveryv1.Discovery, ...options.Option) (KDiscovery, error)
}
Factory is the interface for creating new registrar and discovery components.
type KDiscovery ¶ added in v0.1.18
func NewDiscovery ¶ added in v0.2.6
func NewDiscovery(cfg *discoveryv1.Discovery, opts ...options.Option) (KDiscovery, error)
NewDiscovery creates a new KDiscovery instance using the default factory.
type KRegistrar ¶ added in v0.1.18
func FromOptions ¶ added in v0.2.13
func FromOptions(opts ...options.Option) KRegistrar
FromOptions creates a new Options struct by applying a slice of functional options.
func NewRegistrar ¶ added in v0.2.6
func NewRegistrar(cfg *discoveryv1.Discovery, opts ...options.Option) (KRegistrar, error)
NewRegistrar creates a new KRegistrar instance using the default factory.
type KServiceInstance ¶ added in v0.1.18
type KServiceInstance = registry.ServiceInstance
type Provider ¶ added in v0.2.19
type Provider interface {
Registrar(name string) (KRegistrar, error)
DefaultRegistrar() (KRegistrar, error)
Discovery(name string) (KDiscovery, error)
DefaultDiscovery() (KDiscovery, error)
}
Provider defines the interface for a registry service provider.
func NewProvider ¶ added in v0.2.19
NewProvider creates a new registry provider instance.