router

package
v0.6.12 Latest Latest
Warning

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

Go to latest
Published: Aug 23, 2024 License: MIT Imports: 13 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 interface {
	// BuildPath builds the path for the request and returns a map of Node addresses to their respective paths
	BuildPath(path string, query any, nodes []model.NodeEndpointCache) (map[common.Address]string, error)
	// DistributeRequest sends the request to the Nodes and processes the results
	DistributeRequest(ctx context.Context, nodeMap map[common.Address]string, processResults func([]model.DataResponse)) (model.DataResponse, error)
}

type SimpleRouter

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

func NewSimpleRouter

func NewSimpleRouter(httpClient httputil.Client) *SimpleRouter

func (*SimpleRouter) BuildPath

func (r *SimpleRouter) BuildPath(method, path string, query url.Values, nodes []*model.NodeEndpointCache, body []byte) (map[common.Address]model.RequestMeta, error)

func (*SimpleRouter) DistributeRequest

func (r *SimpleRouter) DistributeRequest(ctx context.Context, nodeMap map[common.Address]model.RequestMeta, processResponses func([]*model.DataResponse)) (model.DataResponse, error)

Jump to

Keyboard shortcuts

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