Documentation ¶
Overview ¶
Package registry is an interface for service discovery
Index ¶
- Constants
- Variables
- type DeregisterOption
- type DeregisterOptions
- type Endpoint
- type Event
- type EventType
- type GetOption
- type GetOptions
- type ListOption
- type ListOptions
- type Node
- type Option
- type Options
- type RegisterOption
- type RegisterOptions
- type Registry
- type Result
- type Service
- type Value
- type WatchOption
- type WatchOptions
- type Watcher
Constants ¶
View Source
const ( // WildcardDomain indicates any domain WildcardDomain = "*" // DefaultDomain to use if none was provided in options DefaultDomain = "micro" )
Variables ¶
View Source
var ( // Not found error when GetService is called ErrNotFound = errors.New("service not found") // Watcher stopped error when watcher is stopped ErrWatcherStopped = errors.New("watcher stopped") )
Functions ¶
This section is empty.
Types ¶
type DeregisterOption ¶ added in v1.18.2
type DeregisterOption func(*DeregisterOptions)
func DeregisterContext ¶ added in v1.18.2
func DeregisterContext(ctx context.Context) DeregisterOption
func DeregisterDomain ¶ added in v1.18.2
func DeregisterDomain(d string) DeregisterOption
type DeregisterOptions ¶ added in v1.18.2
type Event ¶ added in v1.18.2
type Event struct { // Id is registry id Id string // Type defines type of event Type EventType // Timestamp is event timestamp Timestamp time.Time // Service is registry service Service *Service }
Event is registry event
type GetOption ¶ added in v1.18.2
type GetOption func(*GetOptions)
func GetContext ¶ added in v1.18.2
type GetOptions ¶ added in v1.18.2
type ListOption ¶ added in v1.18.2
type ListOption func(*ListOptions)
func ListContext ¶ added in v1.18.2
func ListContext(ctx context.Context) ListOption
func ListDomain ¶ added in v1.18.2
func ListDomain(d string) ListOption
type ListOptions ¶ added in v1.18.2
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
func RegisterContext ¶ added in v1.18.2
func RegisterContext(ctx context.Context) RegisterOption
func RegisterDomain ¶ added in v1.18.2
func RegisterDomain(d string) RegisterOption
func RegisterTTL ¶
func RegisterTTL(t time.Duration) RegisterOption
type RegisterOptions ¶
type Registry ¶
type Registry interface { Init(...Option) error Options() Options Register(*Service, ...RegisterOption) error Deregister(*Service, ...DeregisterOption) error GetService(string, ...GetOption) ([]*Service, error) ListServices(...ListOption) ([]*Service, error) Watch(...WatchOption) (Watcher, error) String() string }
The registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, ...}
type Result ¶
Result is returned by a call to Next on the watcher. Actions can be create, update, delete
type WatchOption ¶ added in v0.4.0
type WatchOption func(*WatchOptions)
func WatchContext ¶ added in v1.18.2
func WatchContext(ctx context.Context) WatchOption
func WatchDomain ¶ added in v1.18.2
func WatchDomain(d string) WatchOption
type WatchOptions ¶ added in v0.4.0
Directories ¶
Path | Synopsis |
---|---|
Package cache provides a registry cache
|
Package cache provides a registry cache |
Package mdns provides a multicast dns registry
|
Package mdns provides a multicast dns registry |
Package memory provides an in-memory registry
|
Package memory provides an in-memory registry |
Package noop is a registry which does nothing
|
Package noop is a registry which does nothing |
Click to show internal directories.
Click to hide internal directories.