Versions in this module Expand all Collapse all v0 v0.0.3 Jul 5, 2024 v0.0.2 Jun 10, 2024 Changes in this version + const GroupCfxArchives + const GroupCfxHttp + const GroupCfxLogs + const GroupCfxWs + const GroupDebugHttp + const GroupEthHttp + const GroupEthLogs + const GroupEthWs + var ErrClientUnavailable = errors.New("no full node available") + func EthFactory() *factory + func Factory() *factory + func NewServer(nf nodeFactory, groupConf map[Group]UrlConfig) *rpc.Server + type CfxClientProvider struct + func NewCfxClientProvider(router Router) *CfxClientProvider + func (p *CfxClientProvider) GetClientByIP(ctx context.Context) (sdk.ClientOperator, error) + func (p *CfxClientProvider) GetClientByIPGroup(ctx context.Context, group Group) (sdk.ClientOperator, error) + type CfxNode struct + func NewCfxNode(group Group, name, url string, hm HealthMonitor) *CfxNode + func (n *CfxNode) Close() + func (n *CfxNode) LatestEpochNumber() (uint64, error) + func (n CfxNode) Name() string + func (n CfxNode) Status() Status + func (n CfxNode) String() string + func (n CfxNode) Url() string + type EthClientProvider struct + func NewEthClientProvider(router Router) *EthClientProvider + func (p *EthClientProvider) GetClientByIP(ctx context.Context) (*Web3goClient, error) + func (p *EthClientProvider) GetClientByIPGroup(ctx context.Context, group Group) (*Web3goClient, error) + func (p *EthClientProvider) GetClientRandom() (*Web3goClient, error) + func (p *EthClientProvider) GetClientRandomByGroup(group Group) (*Web3goClient, error) + type EthNode struct + func NewEthNode(group Group, name, url string, hm HealthMonitor) *EthNode + func (n *EthNode) LatestEpochNumber() (uint64, error) + func (n EthNode) Close() + func (n EthNode) Name() string + func (n EthNode) Status() Status + func (n EthNode) String() string + func (n EthNode) Url() string + type Group string + func (g Group) Space() string + func (g Group) String() string + type HealthMonitor interface + HealthyEpoch func() uint64 + ReportEpoch func(nodeName string, epoch uint64) + ReportHealthy func(nodeName string) + ReportUnhealthy func(nodeName string, remind bool, reason error) + type LocalRouter struct + func NewLocalRouter(group2Urls map[Group][]string) *LocalRouter + func NewLocalRouterFromNodeRPC(client *rpc.Client, groupConf map[Group]UrlConfig) (*LocalRouter, error) + func (r *LocalRouter) Route(group Group, key []byte) string + type Manager struct + func NewManager(group Group, nf nodeFactory, urls []string) *Manager + func NewManagerWithRepartition(group Group, nf nodeFactory, urls []string, resolver RepartitionResolver) *Manager + func (m *Manager) Add(url string) + func (m *Manager) Distribute(key []byte) Node + func (m *Manager) Get(url string) Node + func (m *Manager) HealthyEpoch() uint64 + func (m *Manager) List() []Node + func (m *Manager) Remove(url string) + func (m *Manager) ReportEpoch(nodeName string, epoch uint64) + func (m *Manager) ReportHealthy(nodeName string) + func (m *Manager) ReportUnhealthy(nodeName string, remind bool, reason error) + func (m *Manager) Route(key []byte) string + func (m *Manager) String() string + type Node interface + Close func() + LatestEpochNumber func() (uint64, error) + Name func() string + Status func() Status + Url func() string + type NodeRpcRouter struct + func NewNodeRpcRouter(client *rpc.Client) *NodeRpcRouter + func (r *NodeRpcRouter) Route(group Group, key []byte) string + type RedisRepartitionResolver struct + func NewRedisRepartitionResolver(client *redis.Client, ttl time.Duration, keyPrefix string) *RedisRepartitionResolver + func (r *RedisRepartitionResolver) Get(key uint64) (string, bool) + func (r *RedisRepartitionResolver) Put(key uint64, value string) + type RedisRouter struct + func NewRedisRouter(client *redis.Client) *RedisRouter + func (r *RedisRouter) Route(group Group, key []byte) string + type RepartitionResolver interface + Get func(key uint64) (string, bool) + Put func(key uint64, value string) + type Router interface + Route func(group Group, key []byte) string + func MustNewRouter(redisURL string, nodeRPCURL string, groupConf map[Group]UrlConfig) Router + func NewChainedRouter(groupConf map[Group]UrlConfig, routers ...Router) Router + type SimpleRepartitionResolver struct + func NewSimpleRepartitionResolver(ttl time.Duration) *SimpleRepartitionResolver + func (r *SimpleRepartitionResolver) Get(key uint64) (string, bool) + func (r *SimpleRepartitionResolver) Put(key uint64, value string) + type Status struct + func NewStatus(group Group, nodeName string) Status + func (s *Status) Close() + func (s *Status) MarshalJSON() ([]byte, error) + func (s *Status) Update(n Node, monitor HealthMonitor) + type UrlConfig struct + Failover string + Nodes []string + type Web3goClient struct + URL string