Documentation
¶
Index ¶
- Variables
- type Config
- type Metrics
- type Network
- type Pool
- func (p *Pool) GetHealthyExecutionNode() execution.Node
- func (p *Pool) GetHealthyExecutionNodes() []execution.Node
- func (p *Pool) GetNetworkByChainID(chainID int64) (*Network, error)
- func (p *Pool) HasExecutionNodes() bool
- func (p *Pool) HasHealthyExecutionNodes() bool
- func (p *Pool) Start(ctx context.Context)
- func (p *Pool) Stop(ctx context.Context) error
- func (p *Pool) UpdateNodeMetrics()
- func (p *Pool) WaitForHealthyExecutionNode(ctx context.Context) (execution.Node, error)
Constants ¶
This section is empty.
Variables ¶
var ( // ErrNoHealthyNode indicates no healthy execution node is available. ErrNoHealthyNode = errors.New("no healthy execution node available") // ErrBlockNotFound indicates a block was not found on the execution client. ErrBlockNotFound = errors.New("block not found") // ErrTransactionNotFound indicates a transaction was not found. ErrTransactionNotFound = errors.New("transaction not found") // ErrUnsupportedChainID indicates an unsupported chain ID was provided. ErrUnsupportedChainID = errors.New("unsupported chain ID") )
Sentinel errors for Ethereum client operations.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Metrics ¶
type Metrics struct {
// contains filtered or unexported fields
}
func GetMetricsInstance ¶
func (*Metrics) SetNodesTotal ¶
type Network ¶
type Network struct {
Name string
}
func GetNetworkByChainID ¶
GetNetworkByChainID returns the network information for the given chain ID.
type Pool ¶
type Pool struct {
// contains filtered or unexported fields
}
func NewPool ¶
func NewPool(log logrus.FieldLogger, namespace string, config *Config) *Pool
NewPool creates a new pool from config, using RPC nodes. This function imports go-ethereum types through the geth package. For embedded mode (no go-ethereum dependency), use NewPoolWithNodes instead.
func NewPoolWithNodes ¶ added in v0.1.5
func NewPoolWithNodes(log logrus.FieldLogger, namespace string, nodes []execution.Node, config *Config) *Pool
NewPoolWithNodes creates a pool with pre-created Node implementations. Use this when embedding execution-processor as a library where the host provides custom Node implementations (e.g., EmbeddedNode with DataSource).
Parameters:
- log: Logger for pool operations
- namespace: Metrics namespace prefix (will have "_ethereum" appended)
- nodes: Pre-created Node implementations
- config: Optional configuration (nil creates empty config with defaults)
Example:
// Create embedded node with custom data source
dataSource := &MyDataSource{client: myClient}
node := execution.NewEmbeddedNode(log, "my-node", dataSource)
// Create pool with the embedded node
pool := ethereum.NewPoolWithNodes(log, "processor", []execution.Node{node}, nil)
pool.Start(ctx)
// Mark ready when data source is ready
node.MarkReady(ctx)
func (*Pool) GetHealthyExecutionNode ¶
func (*Pool) GetHealthyExecutionNodes ¶
func (*Pool) GetNetworkByChainID ¶
GetNetworkByChainID returns the network information for the given chain ID. If overrideNetworkName is set in config, it returns that name instead of using networkMap.
func (*Pool) HasExecutionNodes ¶
func (*Pool) HasHealthyExecutionNodes ¶
func (*Pool) UpdateNodeMetrics ¶
func (p *Pool) UpdateNodeMetrics()