node_communicator

package
v0.43.1-rc.1.access-me... Latest Latest
Warning

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

Go to latest
Published: Sep 30, 2025 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Communicator

type Communicator interface {
	CallAvailableNode(

		nodes flow.IdentitySkeletonList,

		call func(node *flow.IdentitySkeleton) error,

		shouldTerminateOnError func(node *flow.IdentitySkeleton, err error) bool,
	) error
}

type MainNodeSelector

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

MainNodeSelector is a specific implementation of the node selector. Which performs in-order node selection using fixed list of pre-defined nodes.

func NewMainNodeSelector

func NewMainNodeSelector(nodes flow.IdentitySkeletonList) *MainNodeSelector

func (*MainNodeSelector) HasNext

func (e *MainNodeSelector) HasNext() bool

HasNext returns true if next node is available.

func (*MainNodeSelector) Next

Next returns the next node in the selector.

type NodeCommunicator

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

NodeCommunicator is responsible for calling available nodes in the backend.

func NewNodeCommunicator

func NewNodeCommunicator(circuitBreakerEnabled bool) *NodeCommunicator

NewNodeCommunicator creates a new instance of NodeCommunicator.

func (*NodeCommunicator) CallAvailableNode

func (b *NodeCommunicator) CallAvailableNode(

	nodes flow.IdentitySkeletonList,

	call func(id *flow.IdentitySkeleton) error,

	shouldTerminateOnError func(node *flow.IdentitySkeleton, err error) bool,
) error

CallAvailableNode calls the provided function on the available nodes. It iterates through the nodes and executes the function. If an error occurs, it applies the custom error terminator (if provided) and keeps track of the errors. If the error occurs in circuit breaker, it continues to the next node. If the maximum failed request count is reached, it returns the accumulated errors.

type NodeSelector

type NodeSelector interface {
	Next() *flow.IdentitySkeleton
	HasNext() bool
}

NodeSelector is an interface that represents the ability to select node identities that the access node is trying to reach. It encapsulates the internal logic of node selection and provides a way to change implementations for different types of nodes. Implementations of this interface should define the Next method, which returns the next node identity to be selected. HasNext checks if there is next node available.

type NodeSelectorFactory

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

NodeSelectorFactory is a factory for creating node selectors based on factory configuration and node type. Supported configurations: circuitBreakerEnabled = true - nodes will be pseudo-randomly sampled and picked in-order. circuitBreakerEnabled = false - nodes will be picked from proposed list in-order without any changes.

func NewNodeSelectorFactory

func NewNodeSelectorFactory(circuitBreakerEnabled bool) *NodeSelectorFactory

NewNodeSelectorFactory creates a new instance of NodeSelectorFactory with the provided circuit breaker configuration.

When `circuitBreakerEnabled` is set to true, nodes will be selected using a pseudo-random sampling mechanism and picked in-order. When set to false, nodes will be selected in the order they are proposed, without any changes.

Parameters: - circuitBreakerEnabled: A boolean that controls whether the circuit breaker is enabled for node selection.

func (*NodeSelectorFactory) SelectNodes

SelectNodes selects the configured number of node identities from the provided list of nodes and returns the node selector to iterate through them.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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