Documentation
¶
Overview ¶
Package registry is an interface for service discovery
Index ¶
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 ( ErrWatcherStopped = errors.New("watcher stopped") ErrNotFound = errors.New("not found") )
ErrWatcherStopped Watcher stopped error when watcher is stopped
View Source
var Name = "registry"
Functions ¶
func SetDefault ¶
func SetDefault(r Registry)
Types ¶
type Config ¶ added in v0.2.11
type Config 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() Config
type Registry ¶
type Registry interface {
String() string
Register(context.Context, *service.Service, ...RegOpt) error
Deregister(context.Context, *service.Service, ...DeregOpt) error
}
Registry The registry provides an interface for service discovery and an abstraction over varying implementations {consul, etcd, zookeeper, mdns, ...}
Click to show internal directories.
Click to hide internal directories.