router

package
v0.0.0-...-2b6943d Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type PreRouteHookFunc

type PreRouteHookFunc func(msg *message.Message)

type Router

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

Router struct

func New

func New() *Router

New returns the router

func (*Router) AddPreRouteHook

func (r *Router) AddPreRouteHook(hook PreRouteHookFunc)

func (*Router) AddRoute

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

AddRoute adds a routing function to a server type

func (*Router) PreRouteHook

func (r *Router) PreRouteHook(
	msg *message.Message,
)

func (*Router) Route

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

Route gets the right server to use in the call

type RoutingFunc

type RoutingFunc func(
	ctx context.Context,
	route *route.Route,
	payload []byte,
	rpcType protos.RPCType,
) (*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