Documentation ¶
Overview ¶
Package registry is an interface for service discovery
Index ¶
Constants ¶
View Source
const ( // GlobalDomain indicates any domain GlobalDomain = "*" // DefaultDomain to use if none was provided in options DefaultDomain = "nitro" )
Variables ¶
View Source
var ( // Not found error when GetApp is called ErrNotFound = errors.New("service not found") )
View Source
var ( // Watcher stopped error when watcher is stopped ErrWatcherStopped = errors.New("watcher stopped") )
Functions ¶
This section is empty.
Types ¶
type AddOptions ¶
type App ¶
type App struct { Name string `json:"name"` Version string `json:"version"` Metadata map[string]string `json:"metadata"` // 在注册Handler的时候,Handler是一个命名类型,它有多个方法,每个方法对应一个Endpoint // Endpoint是率属于微服务的,Endpoint的具体执行者是多个Instance中的某一个 Endpoints []*Endpoint `json:"endpoints"` // 每个微服务下可能有多个Instance,多个Instance之间使用负责均衡 Instances []*Instance `json:"instances"` }
微服务
type GetOptions ¶
type ListOption ¶
type ListOption func(*ListOptions)
func ListContext ¶
func ListContext(ctx context.Context) ListOption
func ListDomain ¶
func ListDomain(d string) ListOption
type ListOptions ¶
type RemoveOption ¶
type RemoveOption func(*RemoveOptions)
func RemoveContext ¶
func RemoveContext(ctx context.Context) RemoveOption
func RemoveDomain ¶
func RemoveDomain(d string) RemoveOption
type RemoveOptions ¶
type Result ¶
Result is returned by a call to Next on the watcher. Actions can be create, update, delete
type Table ¶
type Table interface { Init(...Option) error Options() Options Add(*App, ...AddOption) error Remove(*App, ...RemoveOption) error Get(string, ...GetOption) ([]*App, error) List(...ListOption) ([]*App, 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 WatchOption ¶
type WatchOption func(*WatchOptions)
func WatchContext ¶
func WatchContext(ctx context.Context) WatchOption
func WatchDomain ¶
func WatchDomain(d string) WatchOption
type WatchOptions ¶
Click to show internal directories.
Click to hide internal directories.