Documentation
¶
Overview ¶
Package registry is an interface for service discovery
Index ¶
- Variables
- func Register(name string, r Factory)
- type Cfg
- type DeRegOpt
- type DeRegOpts
- type Endpoint
- type Event
- type EventType
- type Factory
- type GetOpt
- type GetOpts
- type ListOpt
- type ListOpts
- type Node
- type Opt
- type Opts
- type RegOpt
- type RegOpts
- type Registry
- type Result
- type Service
- type Value
- type WatchOpt
- type WatchOpts
- type Watcher
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotFound = errors.New("[registry] not found")
View Source
var ErrWatcherStopped = errors.New("[registry] watcher stopped")
Watcher stopped error when watcher is stopped
View Source
var Name = "registry"
View Source
var Prefix = "/registry"
Functions ¶
Types ¶
type Cfg ¶
type Cfg struct {
Driver string `json:"driver"`
}
func GetDefaultCfg ¶
func GetDefaultCfg() Cfg
type Event ¶
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 Node ¶
type Registry ¶
type Registry interface {
Register(*Service, ...RegOpt) error
Deregister(*Service, ...DeRegOpt) error
GetService(string, ...GetOpt) ([]*Service, error)
ListServices(...ListOpt) ([]*Service, error)
Watch(string, ...WatchOpt) (Watcher, error)
String() string
}
The registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, ...}
var Default Registry
type Result ¶
Result is returned by a call to Next on the watcher. Actions can be create, update, delete
Source Files
¶
Click to show internal directories.
Click to hide internal directories.