discovery

package
v2.0.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 21, 2022 License: MIT Imports: 3 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithDiscovery

func ContextWithDiscovery(ctx context.Context) context.Context

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 Discovery

type Discovery interface {
	// RegisteredNode returns service unique ID and rpc address registered for the component.
	RegisteredNode(component string) (int64, string)

	// RegisterNode registers rpc address of the component node.
	RegisterNode(component, rpcAddr string, rpcSvc []string, ttl time.Duration) (int64, error)

	// GetNodes returns rpc service nodes.
	GetNodes(svc string) map[string]int
}

func ContextDiscovery

func ContextDiscovery(ctx context.Context) Discovery

func Implementor

func Implementor() Discovery

Implementor returns the discovery service implementor.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL