Documentation ¶
Index ¶
- Variables
- func DecodeMetadata(tags []string) map[string]string
- func DecodeVersion(tags []string) (string, bool)
- func EncodeEndpoints(en []*Endpoint) []string
- func EncodeMetadata(md map[string]string) []string
- func EncodeVersion(v string) []string
- type Endpoint
- type KVResult
- 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 ¶
This section is empty.
Variables ¶
View Source
var ( // ErrNotFound ErrNotFound ErrNotFound = errors.New("not found") )
Functions ¶
func DecodeMetadata ¶
func DecodeVersion ¶
func EncodeEndpoints ¶
func EncodeMetadata ¶
func EncodeVersion ¶
Types ¶
type Endpoint ¶
type Endpoint struct { Name string `json:"name"` Request *Value `json:"request"` Response *Value `json:"response"` Metadata map[string]string `json:"metadata"` }
Endpoint 服务节点信息
func DecodeEndpoints ¶
type Node ¶
type Node struct { Id string `json:"id"` Address string `json:"address"` Port int `json:"port"` Metadata map[string]string `json:"metadata"` }
Node 服务节点信息
type RegisterOption ¶
type RegisterOption func(*RegisterOptions)
func RegisterTTL ¶
func RegisterTTL(t time.Duration) RegisterOption
type Registry ¶
type Registry interface { Init(...Option) error Options() Options Register(*Service, ...RegisterOption) error Deregister(*Service) error GetService(string) ([]*Service, error) ListServices() ([]*Service, error) Watch(...WatchOption) (Watcher, error) String() string //KV存储 Put(key string, value interface{}) (err error) Get(key string) (rsp *KVResult, err error) Delete(key string) (err error) BlockingQuery(targetPointer interface{}, prefix interface{}, call func(value interface{})) }
Registry 注册表为服务发现提供了一个接口,以及对不同实现的抽象{consul, etcd, zookeeper, ...}
type Value ¶
type Value struct { Name string `json:"name"` Type string `json:"type"` Values []*Value `json:"values"` }
Value Value
type WatchOption ¶
type WatchOption func(*WatchOptions)
type WatchOptions ¶
Click to show internal directories.
Click to hide internal directories.