Documentation
¶
Overview ¶
Package registry is responsible for registering and unregistering services and servers.
Index ¶
- Variables
- func IsNamespaceNotFound(err error) bool
- func IsServersNotFound(err error) bool
- func IsValidationError(err error) bool
- type Registry
- func (r *Registry) ListNamespaces() (discovery.Namespaces, error)
- func (r *Registry) ListServer(selector string) (discovery.Servers, error)
- func (r *Registry) ListService(namespace, selector string) (discovery.Services, error)
- func (r *Registry) ReRegisterAllServices() (numChanges int, err error)
- func (r *Registry) RegisterNamespace(n discovery.Namespace) (*discovery.Namespace, error)
- func (r *Registry) RegisterServer(name string, labels discovery.Labels) (*discovery.Server, error)
- func (r *Registry) RegisterService(s discovery.Service) (*discovery.Service, error)
- func (r Registry) StartCacheUpdater(ctx context.Context, reSyncInterval time.Duration)
- func (r Registry) StartServiceCounterUpdater(ctx context.Context, interval time.Duration)
- func (r *Registry) UnRegisterNamespace(name string) error
- func (r *Registry) UnRegisterServer(name string) error
- func (r *Registry) UnRegisterService(idOrEndpoint, namespace string) error
Constants ¶
This section is empty.
Variables ¶
var ( ErrNoServersFound = errors.New("no servers found") ErrNamespaceNotFound = errors.New("namespace not found") ErrValidation = errors.New("validation error") ErrContainsServices = errors.New("server has registered services") )
Common errors
Functions ¶
func IsNamespaceNotFound ¶ added in v0.7.4
IsNamespaceNotFound returns true on service registration when the specified namespace does not exist.
func IsServersNotFound ¶ added in v0.7.4
IsServersNotFound returns true on service registration when no suitable server is found.
func IsValidationError ¶ added in v0.7.4
IsValidationError returns true if a validation error occurred.
Types ¶
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry registers server or service.
func New ¶
func New(backend store.Backend, reg prometheus.Registerer, log *zap.SugaredLogger, numReplicas int) (*Registry, error)
New creates a new registry.
func (*Registry) ListNamespaces ¶
func (r *Registry) ListNamespaces() (discovery.Namespaces, error)
ListNamespaces lists all services.
func (*Registry) ListServer ¶
ListServer lists servers by selector.
func (*Registry) ListService ¶
ListService lists all services.
func (*Registry) ReRegisterAllServices ¶
ReRegisterAllServices reregisters all services.
func (*Registry) RegisterNamespace ¶
RegisterNamespace registers a namespace.
func (*Registry) RegisterServer ¶
RegisterServer registers a server.
func (*Registry) RegisterService ¶
RegisterService registers a service.
func (Registry) StartCacheUpdater ¶ added in v0.2.2
StartCacheUpdater starts a namespace cache updater. It resyncs cache all reSyncInterval.
func (Registry) StartServiceCounterUpdater ¶ added in v0.7.1
StartServiceCounterUpdater updates service counter metrics every interval. It runs until context ctx is canceled.
func (*Registry) UnRegisterNamespace ¶
UnRegisterNamespace unregisters a namespace.
func (*Registry) UnRegisterServer ¶
UnRegisterServer unregisters a server.
func (*Registry) UnRegisterService ¶
UnRegisterService removes a service by id or endpoint. If namespace is empty string then discovery.DefaultNamespace is used.