Documentation ¶
Overview ¶
Package registry is an interface for service discovery
Index ¶
- Constants
- Variables
- func Dix(lifecycle lifecycle.Lifecycle, app service.AppInfo, cfg *Cfg, ...)
- func SetDefault(r Registry)
- type Cfg
- type DeregOpt
- type DeregOpts
- type Endpoint
- type Event
- type GetOpt
- type GetOpts
- type ListOpt
- type ListOpts
- type Node
- type Nodes
- type Opt
- type Opts
- type RegOpt
- type RegOpts
- type Registry
- type Result
- type Service
- type Value
- type WatchOpt
- type WatchOpts
- type Watcher
Constants ¶
View Source
const ( // DefaultMaxMsgSize define maximum message size that server can send or receive. // Default value is 4MB. DefaultMaxMsgSize = 1024 * 1024 * 4 DefaultSleepAfterDeRegister = time.Second * 2 // DefaultRegisterTTL The register expiry time DefaultRegisterTTL = time.Minute // DefaultRegisterInterval The interval on which to register DefaultRegisterInterval = time.Second * 30 DefaultSleepAfterDeregister = time.Second * 2 )
View Source
const DefaultPrefix = "/registry"
Variables ¶
View Source
var ErrNotFound = errors.New("not found")
View Source
var ErrWatcherStopped = errors.New("watcher stopped")
ErrWatcherStopped Watcher stopped error when watcher is stopped
View Source
var Name = "registry"
Functions ¶
func SetDefault ¶
func SetDefault(r Registry)
Types ¶
type Cfg ¶
type Cfg struct { RegisterInterval time.Duration `yaml:"registerInterval"` Driver string `json:"driver" yaml:"driver"` DriverCfg map[string]interface{} `json:"driver_config" yaml:"driver_config"` }
func DefaultCfg ¶
func DefaultCfg() Cfg
type Event ¶
type Event struct { // Id is registry id Id string // Type defines type of event Type event.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 { String() string Register(*Service, ...RegOpt) error Deregister(*Service, ...DeregOpt) error Watch(string, ...WatchOpt) (Watcher, error) ListService(...ListOpt) ([]*Service, error) GetService(string, ...GetOpt) ([]*Service, error) }
Registry The registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, mdns, ...}
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.