node

package
v0.60.0 Latest Latest
Warning

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

Go to latest
Published: Oct 25, 2022 License: MIT Imports: 15 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoNodeConfigured       = errors.New("no node configured on round-robin selector")
	ErrNoHealthyNodeAvailable = errors.New("no healthy node available")
)

Functions

This section is empty.

Types

type ErrorCode

type ErrorCode codes.Code

type InsecureGRPCClient

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

func NewInsecureGRPCClient

func NewInsecureGRPCClient(host string) (*InsecureGRPCClient, error)

func (*InsecureGRPCClient) CheckTransaction

func (*InsecureGRPCClient) GetVegaTime

func (*InsecureGRPCClient) Host

func (c *InsecureGRPCClient) Host() string

func (*InsecureGRPCClient) LastBlockHeight

func (*InsecureGRPCClient) Stop

func (c *InsecureGRPCClient) Stop() error

func (*InsecureGRPCClient) SubmitTransaction

type Node added in v0.56.0

Node is the component used to get network information and send transactions.

type ReportType added in v0.56.0

type ReportType string

ReportType defines the type of event that occurred.

var (
	InfoEvent    ReportType = "Info"
	WarningEvent ReportType = "Warning"
	ErrorEvent   ReportType = "Error"
	SuccessEvent ReportType = "Success"
)

type RetryingGRPCNode

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

func BuildRetryingGRPCNode added in v0.56.0

func BuildRetryingGRPCNode(log *zap.Logger, client CoreClient, retries uint64) *RetryingGRPCNode

func NewRetryingGRPCNode added in v0.56.0

func NewRetryingGRPCNode(log *zap.Logger, host string, retries uint64) (*RetryingGRPCNode, error)

func (*RetryingGRPCNode) CheckTransaction

func (*RetryingGRPCNode) HealthCheck

func (n *RetryingGRPCNode) HealthCheck(ctx context.Context) error

HealthCheck returns an error if the node is not healthy. Contrary to the other calls, it doesn't retry if the call ends up in error to avoid useless delay in during node selection.

func (*RetryingGRPCNode) Host

func (n *RetryingGRPCNode) Host() string

func (*RetryingGRPCNode) LastBlock

LastBlock returns information about the last block acknowledged by the node.

func (*RetryingGRPCNode) SendTransaction

func (*RetryingGRPCNode) Stop

func (n *RetryingGRPCNode) Stop() error

type RoundRobinSelector

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

RoundRobinSelector uses a classic round-robin algorithm to select a node. When requesting the next node, this is the node right behind the current one that is selected. When the last node is reached, it starts over the first one.

func NewRoundRobinSelector

func NewRoundRobinSelector(log *zap.Logger, nodes ...Node) (*RoundRobinSelector, error)

func (*RoundRobinSelector) Node

func (ns *RoundRobinSelector) Node(ctx context.Context, reporterFn SelectionReporter) (Node, error)

func (*RoundRobinSelector) Stop

func (ns *RoundRobinSelector) Stop()

Stop stops all the registered nodes. If a node raises an error during closing, the selector ignores it and carry on a best-effort.

type SelectionReporter added in v0.56.0

type SelectionReporter func(ReportType, string)

type Selector added in v0.56.0

type Selector interface {
	Node(ctx context.Context, reporterFn SelectionReporter) (Node, error)
	Stop()
}

Selector implementing the strategy for node selection.

func BuildRoundRobinSelectorWithRetryingNodes added in v0.56.0

func BuildRoundRobinSelectorWithRetryingNodes(log *zap.Logger, hosts []string, retries uint64) (Selector, error)

type StatusError

type StatusError struct {
	Code    codes.Code
	Details []string
}

func (*StatusError) Error

func (e *StatusError) Error() string

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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