registry

package
v0.2.19 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 17, 2026 License: MIT Imports: 13 Imported by: 4

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

View Source
const (
	// CategoryRegistrar is the category for registrar components.
	CategoryRegistrar component.Category = "registrar"
	// CategoryDiscovery is the category for discovery components.
	CategoryDiscovery component.Category = "discovery"
)
View Source
const Module = "registry"

Variables

View Source
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.

View Source
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.

View Source
var (
	ErrRegistryNotFound = runtimeerrors.NewStructured("registry", "registry not found")
)

Functions

func GetDiscoveries added in v0.2.19

func GetDiscoveries(ctx context.Context, h component.Locator) (map[string]KDiscovery, error)

GetDiscoveries collects all discovery instances from the given locator.

func Register added in v0.2.6

func Register(name string, factory Factory)

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

type KDiscovery = registry.Discovery

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

type KRegistrar = registry.Registrar

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 KWatcher added in v0.1.18

type KWatcher = registry.Watcher

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

func NewProvider(locator component.Locator) Provider

NewProvider creates a new registry provider instance.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL