discovery

package
v0.1.8 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 3 Imported by: 0

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)

Register 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 {
	// Return service unique ID and rpc address registered for the component.
	RegisteredNode(component string) (int64, string)

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

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

func ContextDiscovery

func ContextDiscovery(ctx context.Context) Discovery

func Implementor

func Implementor() Discovery

Return the service implementor.

Jump to

Keyboard shortcuts

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