rpc

package
v0.0.0-...-3ced3f3 Latest Latest
Warning

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

Go to latest
Published: Oct 15, 2020 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DefaultRoute

func DefaultRoute(session interfaces.ISession, msg RpcMsg, context RouteContextClass, cb Callback)

Calculate route info and return an appropriate node id.

func RandomRoute

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

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 RouteContext

type RouteContext struct {
}

type RouteContextClass

type RouteContextClass interface {
	GetNodesByType(nodeType string) RouteNodes
}

type RouteNodes

type RouteNodes []RpcNodeInfo

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
	}
}

type RpcClientOpts

type RpcClientOpts struct {
}

type RpcMsg

type RpcMsg interface {
	Namespace() string
	NodeType() string
	Service() 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