client

package
v0.0.0-...-e773f2c Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoNodeAvailable = fmt.Errorf("no node available")
)

common errors

Functions

func NewLoadBalanceFullNodeRPCV1

func NewLoadBalanceFullNodeRPCV1(ctx context.Context, addrs []string, requestHeaders []http.Header) (v1api.FullNode, jsonrpc.ClientCloser, error)

func NewLoadBalanceMergeClient

func NewLoadBalanceMergeClient(ctx context.Context, addrs []string, requestHeaders []http.Header, outs []interface{}) (jsonrpc.ClientCloser, error)

Types

type Coordinator

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

func NewCoordinator

func NewCoordinator() (*Coordinator, error)

func (*Coordinator) ChainNotify

func (c *Coordinator) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error)

ChainNotify impls api.FullNode.ChainNotify

func (*Coordinator) MpoolPushMessage

func (c *Coordinator) MpoolPushMessage(context context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error)

func (*Coordinator) RunNode

func (c *Coordinator) RunNode(ctx context.Context, addr string, header http.Header, opt NodeOption) error

func (*Coordinator) RunNodesHeightChecker

func (c *Coordinator) RunNodesHeightChecker(ctx context.Context, genesis *types.TipSet)

func (*Coordinator) Select

func (c *Coordinator) Select() (v1api.FullNode, error)

func (*Coordinator) Start

Start starts the coordinate loop

type Local

type Local interface {
	// ChainNotify returns channel with chain head updates.
	// First message is guaranteed to be of len == 1, and type == 'current'.
	ChainNotify(context.Context) (<-chan []*api.HeadChange, error)

	// Signed message and Propagating the signed message to all live nodes
	MpoolPushMessage(context.Context, *types.Message, *api.MessageSendSpec) (*types.SignedMessage, error)
}

type MajorMinorVersion

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

type Node

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

func (*Node) CheckHealth

func (n *Node) CheckHealth(ctx context.Context) (api.Version, error)

func (*Node) Start

func (n *Node) Start(c context.Context) context.CancelFunc

type NodeOption

type NodeOption struct {
	ReListenMinInterval time.Duration
	ReListenMaxInterval time.Duration

	APITimeout time.Duration
}

NodeOption is for node configuration

func DefaultNodeOption

func DefaultNodeOption() NodeOption

DefaultNodeOption returns default options

type Selector

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

func (*Selector) GetAllLiveNodes

func (s *Selector) GetAllLiveNodes() ([]*Node, error)

func (*Selector) RunNode

func (s *Selector) RunNode(ctx context.Context, node *Node) error

func (*Selector) Select

func (s *Selector) Select() (*Node, error)

Select tries to choose a node from the candidates

func (*Selector) StopAllNode

func (s *Selector) StopAllNode()

func (*Selector) StopNodes

func (s *Selector) StopNodes(nodeAddrs []string)

Jump to

Keyboard shortcuts

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