Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
ETHClient *ethclients.ETHClientWithMaxConcurrentCalls
// contains filtered or unexported fields
}
func NewClientFromDial ¶
func NewClientFromETHClient ¶
func NewClientFromETHClient( parentContext context.Context, ethNodeClient ethclients.ETHClient, config *ClientConfig, ) (*Client, error)
NewClientFromETHClient creates a new Client with the given underlying ETHClient and applies the provided configuration.
func (*Client) Close ¶
func (c *Client) Close()
Close gracefully stops health monitoring and closes the client connection.
func (*Client) LatestBlockNumber ¶
LatestBlockNumber safely returns the client's latest block number
type ClientConfig ¶
type ClientConfig struct {
MonitorHealthInterval time.Duration // How often to perform health checks.
HealthCheckRPCTimeout time.Duration // Timeout for the RPC call within each health check.
WaitHealthyPollInterval time.Duration // How often to poll for health in WaitUntilHealthy.
MaxConcurrentETHCalls int // Maximum concurrent calls allowed to the underlying ETHClient.
DialTimeout time.Duration // timeout for dial client
Logger Logger
}
ClientConfig holds configuration parameters for the Client.
type ClientManager ¶
type ClientManager struct {
// contains filtered or unexported fields
}
func NewClientManager ¶
func NewClientManager( ctx context.Context, endpoints []string, config *ClientManagerConfig, ) (*ClientManager, error)
NewClientManager creates a new ClientManager, dialing each provided endpoint.
func NewClientManagerFromClients ¶
func NewClientManagerFromClients( clients []*Client, config *ClientManagerConfig, ) (*ClientManager, error)
func (*ClientManager) Close ¶
func (cm *ClientManager) Close()
Close gracefully cancels all subscriptions and closes all clients.
func (*ClientManager) GetClient ¶
func (cm *ClientManager) GetClient() (ethclients.ETHClient, error)
GetClient returns an Ethereum client, preferring one that is healthy and up-to-date.
func (*ClientManager) GetClients ¶
func (cm *ClientManager) GetClients() []ethclients.ETHClient
GetClients returns all Ethereum clients.
func (*ClientManager) GetPreferredClient ¶
func (cm *ClientManager) GetPreferredClient() (ethclients.ETHClient, error)
problem - client manager might have to manage multiple clients in different geographical locations users might need `preferred` clients, clients faster than the average how do we select these clients? we set a cutoff and we pick randomly
type ClientManagerConfig ¶
type ClientManagerConfig struct {
ClientConfig *ClientConfig
PreferredClientMaxLatencyMultiplier int
Logger Logger
}
type DefaultLogger ¶
type DefaultLogger struct {
}
func (*DefaultLogger) Debug ¶
func (logger *DefaultLogger) Debug(msg string, args ...any)
func (*DefaultLogger) Error ¶
func (logger *DefaultLogger) Error(msg string, args ...any)
func (*DefaultLogger) Info ¶
func (logger *DefaultLogger) Info(msg string, args ...any)
func (*DefaultLogger) Warn ¶
func (logger *DefaultLogger) Warn(msg string, args ...any)