_bak

package
v1.1.13 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRoute

func DefaultRoute(session *cherrySession.Session, msg RpcMsg, context RouteContextClass, cb Callback)

DefaultRoute Calculate route info and return an appropriate node id.

func RandomRoute

func RandomRoute(client *RPCClient, nodeType string, msg RpcMsg, cb Callback)

RandomRoute Random algorithm for calculating node id.

func RoundRobinRoute

func RoundRobinRoute(client *RPCClient, nodeType string, msg RpcMsg, cb Callback)

func WeightRoundRoute

func WeightRoundRoute(client *RPCClient, nodeType string, msg RpcMsg, cb Callback)

Types

type Callback

type Callback func(error error, nodeId string)

type RPCClient

type RPCClient struct {
	Nodes   map[string]RpcNodeInfo
	NodeMap map[string][]string

	RoundRobinParam  map[string]int
	WeightRoundParam map[string]struct {
		Index  int
		Weight int
	}
	// contains filtered or unexported fields
}

type RPCClientOpts

type RPCClientOpts struct {
}

type RouteContext

type RouteContext struct {
}

type RouteContextClass

type RouteContextClass interface {
	GetNodesByType(nodeType string) RouteNodes
}

type RouteNodes

type RouteNodes []RpcNodeInfo

type RpcMsg

type RpcMsg interface {
	Namespace() string
	NodeType() string
	HandleName() string
	Method() string
	Args() []interface{}
}

type RpcNodeInfo

type RpcNodeInfo struct {
	Id       string
	Host     string
	Port     int
	NodeType string
	// contains filtered or unexported fields
}

type TargetRouteFunction

type TargetRouteFunction func(nodeType string, msg RpcMsg, routeParam interface{}, cb Callback)

Jump to

Keyboard shortcuts

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