Documentation ¶
Index ¶
- Variables
- func ContextWithDiscovery(ctx context.Context) context.Context
- func RegisterBackendImplementor(backend Backend)
- func RegisterImplementor(svc Discovery)
- func StreamServerInterceptor() grpc.StreamServerInterceptor
- func UnaryServerInterceptor() grpc.UnaryServerInterceptor
- type Backend
- type Discovery
- type EventChan
- type EventType
- type KVPair
- type KVPairs
- type Option
- type Options
- type WatchEvent
Constants ¶
This section is empty.
Variables ¶
View Source
var EmptyOptions = func() *Options { return &Options{ TTL: time.Second * 3, } }
Functions ¶
func RegisterBackendImplementor ¶ added in v2.0.2
func RegisterBackendImplementor(backend Backend)
RegisterBackendImplementor registers the discovery backend service implementor.
func RegisterImplementor ¶
func RegisterImplementor(svc Discovery)
RegisterImplementor registers the discovery service implementor.
func StreamServerInterceptor ¶
func StreamServerInterceptor() grpc.StreamServerInterceptor
StreamServerInterceptor returns a new streaming server interceptor for service discovery.
func UnaryServerInterceptor ¶
func UnaryServerInterceptor() grpc.UnaryServerInterceptor
UnaryServerInterceptor returns a new unary server interceptor for service discovery.
Types ¶
type Backend ¶ added in v2.0.2
type Backend interface { // Type returns the backend provider type. Type() string // Set value for the specified key with a specified ttl. Set(key, value string, ttl time.Duration) error // Get the value of the specified key or directory. Get(key string, dir bool) (*KVPairs, error) // Incr invokes an atomic value increase for the specified key. Incr(key string) (int64, error) // Watch for changes of the specified key or directory. Watch(key string, version uint64, dir bool) (EventChan, error) // KeepAlive sets value and updates the ttl for the specified key. KeepAlive(key, value string, ttl time.Duration) error // Close the provider connection. Close() }
Backend interface.
func BackendImplementor ¶ added in v2.0.2
func BackendImplementor() Backend
BackendImplementor returns the discovery backend service implementor.
type Discovery ¶
type Discovery interface { // PassthroughAddr returns service unique ID and rpc address registered for the component. PassthroughAddr(component string) (int64, string) // Register rpc address of the component service address. Register(component, addr string, opts ...Option) (int64, error) // GetAddresses returns rpc service addresses. GetAddresses(service string) []resolver.Address }
func ContextDiscovery ¶
func Implementor ¶
func Implementor() Discovery
Implementor returns the discovery service implementor.
type EventChan ¶ added in v2.0.2
type EventChan chan *WatchEvent
type Option ¶ added in v2.0.2
type Option func(options *Options)
func WithIsolate ¶ added in v2.0.2
func WithServices ¶ added in v2.0.2
type WatchEvent ¶ added in v2.0.2
Click to show internal directories.
Click to hide internal directories.