router

package
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Jul 31, 2018 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Router

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

Router struct

func New

func New() *Router

New returns the router

func (*Router) AddRoute

func (r *Router) AddRoute(
	serverType string,
	routingFunction RoutingFunc,
)

AddRoute adds a routing function to a server type

func (*Router) Route

func (r *Router) Route(
	rpcType protos.RPCType,
	svType string,
	session *session.Session,
	route *route.Route,
	msg *message.Message,
) (*cluster.Server, error)

Route gets the right server to use in the call

func (*Router) SetServiceDiscovery

func (r *Router) SetServiceDiscovery(sd cluster.ServiceDiscovery)

SetServiceDiscovery sets the sd client

type RoutingFunc

type RoutingFunc func(
	session *session.Session,
	route *route.Route,
	payload []byte,
	servers map[string]*cluster.Server,
) (*cluster.Server, error)

RoutingFunc defines a routing function

Jump to

Keyboard shortcuts

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