noder

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Oct 9, 2023 License: MIT Imports: 10 Imported by: 0

README

noder

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoHealthyNodesFound = errors.New("healthy node was not found")
)
View Source
var (
	ErrorNoSpecifiedNodesFound = errors.New("no specified nodes found")
)

Functions

This section is empty.

Types

type MultiChainNodesStorage

type MultiChainNodesStorage interface {
	Add(node Node) error
	GetByChainId(chainId int64) (*Node, error)
	ToSingleChain(chainId int64) (NodesStorage, error)
}

func NewInmemoryMultiChainNodesStorage

func NewInmemoryMultiChainNodesStorage() MultiChainNodesStorage

type Node

type Node struct {
	Rpc    *ethclient.Client `fig:"rpc,required"`
	RpcUrl string            `fig:"rpc,required"`

	Ws    *ethclient.Client `fig:"ws"`
	WsUrl string            `fig:"ws"`

	ChainId int64 `fig:"chain_id,required"`
}

func (Node) CheckHealth

func (n Node) CheckHealth() bool

CheckHealth tries to get current block number and if it fails, returns false (and true otherwise, respectively)

func (Node) Name

func (n Node) Name() string

Name returns a string representation of the node

type Noder

type Noder interface {
	Nodes() []Node
	MultiChainNodesStorage() MultiChainNodesStorage
	NodesStorage() NodesStorage
}

func NewInmemoryHealthy

func NewInmemoryHealthy(getter kv.Getter, kvKey *string) Noder

type NodesStorage

type NodesStorage interface {
	Add(node Node) error
	Get() (*Node, error)
}

func NewInmemoryNodesStorage

func NewInmemoryNodesStorage() NodesStorage

Jump to

Keyboard shortcuts

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