discover

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2020 License: Apache-2.0 Imports: 18 Imported by: 2

README

discover

gRPC based service discovery library

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Serve

func Serve(configs *ServerConfig) (pb2.Registry, error)

Types

type MsgClient

type MsgClient struct {
	// contains filtered or unexported fields
}

MsgClient is a zebou messaging based client client

func NewMSGClient

func NewMSGClient(server string, tlsConfig *tls.Config) *MsgClient

NewMSGClient creates and initialize a discovery client based

func (*MsgClient) Certificate

func (m *MsgClient) Certificate(id string) ([]byte, error)

Certificate returns the PEM encoded certificate of the service info from local store that matches id

func (*MsgClient) ConnectionInfo

func (m *MsgClient) ConnectionInfo(id string, protocol pb2.Protocol) (*pb2.ConnectionInfo, error)

ConnectionInfo finds the service frolm local store that matches id, and return the connection info of the node that implement the given transport protocol

func (*MsgClient) DeregisterEventHandler

func (m *MsgClient) DeregisterEventHandler(id string)

DeregisterEventHandler removes the event handler that match id

func (*MsgClient) DeregisterService

func (m *MsgClient) DeregisterService(id string, nodes ...string) error

DeregisterService sends a deregister message to the discovery server

func (*MsgClient) FirstOfType

func (m *MsgClient) FirstOfType(t pb2.Type) (*pb2.Info, error)

FirstOfType returns the first service from local store of type t

func (*MsgClient) GetNode

func (m *MsgClient) GetNode(id string, nodeID string) (*pb2.Node, error)

GetNode returns the gRPC node of the service info from local store that matches id

func (*MsgClient) GetOfType

func (m *MsgClient) GetOfType(t pb2.Type) ([]*pb2.Info, error)

GetOfType gets all the service of type t

func (*MsgClient) GetService

func (m *MsgClient) GetService(id string) (*pb2.Info, error)

GetService returns service info from local store that matches id

func (*MsgClient) RegisterEventHandler

func (m *MsgClient) RegisterEventHandler(h pb2.EventHandler) string

RegisterEventHandler adds an event handler. Returns an id that is used to deregister h

func (*MsgClient) RegisterService

func (m *MsgClient) RegisterService(info *pb2.Info) error

RegisterService sends register message to the discovery server

func (*MsgClient) Stop

func (m *MsgClient) Stop() error

Stop closes the messaging connection

type ServerConfig

type ServerConfig struct {
	StoreDir     string
	BindAddress  string
	CertFilename string
	KeyFilename  string
}

Jump to

Keyboard shortcuts

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