registryserver

package
v0.5.14 Latest Latest
Warning

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

Go to latest
Published: Oct 23, 2019 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type NodeInfo

type NodeInfo struct {
	//NodeID controller node id
	NodeID string
	//Endpoint node controller endpoint
	Endpoint string
}

type RegistryListener

type RegistryListener interface {
	// OnNodeAdded is called by RegistryServer whenever a new node controller is registered
	// or node controller updated its endpoint.
	// In case of error, the node registration would fail and removed from registry.
	OnNodeAdded(ctx context.Context, node *NodeInfo) error
	// OnNodeDeleted is called by RegistryServer whenever a node controller unregistered.
	// Callback implementations has to note that by the time this method is called,
	// the NodeInfo for that node have already removed from in-memory registry.
	OnNodeDeleted(ctx context.Context, node *NodeInfo)
}

RegistryListener is an interface for registry server change listeners All the callbacks are called once after updating the in-memory registry data.

type RegistryServer

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

func New

func New(tlsConfig *tls.Config) *RegistryServer

func (*RegistryServer) AddListener

func (rs *RegistryServer) AddListener(l RegistryListener)

func (*RegistryServer) ConnectToNodeController

func (rs *RegistryServer) ConnectToNodeController(nodeId string) (*grpc.ClientConn, error)

ConnectToNodeController initiates a connection to controller running at nodeId

func (*RegistryServer) GetNodeController

func (rs *RegistryServer) GetNodeController(nodeID string) (NodeInfo, error)

GetNodeController returns the node controller info for given nodeID, error if not found

func (*RegistryServer) NodeClients

func (rs *RegistryServer) NodeClients() map[string]*NodeInfo

NodeClients returns a new map which contains a copy of all currently known node clients. It is safe to use concurrently with the other methods.

func (*RegistryServer) RegisterController

func (*RegistryServer) RegisterService

func (rs *RegistryServer) RegisterService(rpcServer *grpc.Server)

Jump to

Keyboard shortcuts

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