registry

package
v0.7.1 Latest Latest
Warning

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

Go to latest
Published: May 18, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Overview

Package registry is responsible for registering and unregistering services and servers.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound         = errors.New("not found")
	ErrContainsServices = errors.New("server has registered services")
)

Common errors

Functions

This section is empty.

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

func (r *Registry) ListServer(selector string) (discovery.Servers, error)

ListServer lists servers by selector.

func (*Registry) ListService

func (r *Registry) ListService(namespace, selector string) (discovery.Services, error)

ListService lists all services.

func (*Registry) ReRegisterAllServices

func (r *Registry) ReRegisterAllServices() (numChanges int, err error)

ReRegisterAllServices reregisters all services.

func (*Registry) RegisterNamespace

func (r *Registry) RegisterNamespace(n discovery.Namespace) (*discovery.Namespace, error)

RegisterNamespace registers a namespace.

func (*Registry) RegisterServer

func (r *Registry) RegisterServer(name string, labels discovery.Labels) (*discovery.Server, error)

RegisterServer registers a server.

func (*Registry) RegisterService

func (r *Registry) RegisterService(s discovery.Service) (*discovery.Service, error)

RegisterService registers a service.

func (Registry) StartCacheUpdater added in v0.2.2

func (r Registry) StartCacheUpdater(ctx context.Context, reSyncInterval time.Duration)

StartCacheUpdater starts a namespace cache updater. It resyncs cache all reSyncInterval.

func (Registry) StartServiceCounterUpdater added in v0.7.1

func (r Registry) StartServiceCounterUpdater(ctx context.Context, interval time.Duration)

StartServiceCounterUpdater updates service counter metrics every interval. It runs until context ctx is canceled.

func (*Registry) UnRegisterNamespace

func (r *Registry) UnRegisterNamespace(name string) error

UnRegisterNamespace unregisters a namespace.

func (*Registry) UnRegisterServer

func (r *Registry) UnRegisterServer(name string) error

UnRegisterServer unregisters a server.

func (*Registry) UnRegisterService

func (r *Registry) UnRegisterService(idOrEndpoint, namespace string) error

UnRegisterService removes a service by id or endpoint. If namespace is empty string then discovery.DefaultNamespace is used.

Jump to

Keyboard shortcuts

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