Documentation
¶
Index ¶
- Variables
- func MustInitFromViper()
- type CfxCache
- func (cache *CfxCache) GetClientVersion(cfx sdk.ClientOperator) (string, bool, error)
- func (cache *CfxCache) GetClientVersionWithFunc(rawGetter func() (string, error)) (string, bool, error)
- func (cache *CfxCache) GetGasPrice(cfx sdk.ClientOperator) (*hexutil.Big, bool, error)
- func (cache *CfxCache) GetGasPriceWithFunc(rawGetter func() (*hexutil.Big, error)) (*hexutil.Big, bool, error)
- type EthCache
- func (cache *EthCache) AddPendingTransaction(txnHash common.Hash)
- func (cache *EthCache) Call(nodeName string, eth *client.RpcEthClient, callRequest types.CallRequest, ...) (RPCResult, bool, error)
- func (cache *EthCache) CallWithFunc(nodeName string, callRequest types.CallRequest, ...) (RPCResult, bool, error)
- func (cache *EthCache) GetBlockNumber(nodeName string, eth *client.RpcEthClient, blockNums ...types.BlockNumber) (*big.Int, bool, error)
- func (cache *EthCache) GetBlockNumberWithFunc(nodeName string, blockNum types.BlockNumber, ...) (*big.Int, bool, error)
- func (cache *EthCache) GetChainId(eth *client.RpcEthClient) (*uint64, bool, error)
- func (cache *EthCache) GetChainIdWithFunc(rawGetter func() (*uint64, error)) (*uint64, bool, error)
- func (cache *EthCache) GetClientVersion(eth *client.RpcEthClient) (string, bool, error)
- func (cache *EthCache) GetClientVersionWithFunc(rawGetter func() (string, error)) (string, bool, error)
- func (cache *EthCache) GetGasPrice(eth *client.RpcEthClient) (*big.Int, bool, error)
- func (cache *EthCache) GetGasPriceWithFunc(rawGetter func() (*big.Int, error)) (*big.Int, bool, error)
- func (cache *EthCache) GetNetVersion(eth *client.RpcEthClient) (string, bool, error)
- func (cache *EthCache) GetNetVersionWithFunc(rawGetter func() (string, error)) (string, bool, error)
- func (cache *EthCache) GetPendingTransaction(txHash common.Hash) (pendingTxn *ethPendingTxn, loaded, expired bool)
- func (cache *EthCache) RemovePendingTransaction(txHash common.Hash) bool
- type EthCacheConfig
- type RPCResult
- type StatusCache
- func (c *StatusCache) GetBestBlockHash(nodeName string, cfx sdk.ClientOperator) (types.Hash, bool, error)
- func (c *StatusCache) GetBestBlockHashWithFunc(nodeName string, rawGetter func() (types.Hash, error)) (types.Hash, bool, error)
- func (c *StatusCache) GetEpochNumber(nodeName string, cfx sdk.ClientOperator, epoch *types.Epoch) (*hexutil.Big, bool, error)
- func (c *StatusCache) GetEpochNumberWithFunc(nodeName string, epoch *types.Epoch, ...) (*hexutil.Big, bool, error)
- func (c *StatusCache) GetStatus(nodeName string, cfx sdk.ClientOperator) (types.Status, bool, error)
- func (c *StatusCache) GetStatusWithFunc(nodeName string, rawGetter func() (types.Status, error)) (types.Status, bool, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var CfxDefault = NewCfx()
Functions ¶
func MustInitFromViper ¶
func MustInitFromViper()
Types ¶
type CfxCache ¶
type CfxCache struct {
*StatusCache
// contains filtered or unexported fields
}
CfxCache memory cache for some core space RPC methods
func (*CfxCache) GetClientVersion ¶
func (*CfxCache) GetClientVersionWithFunc ¶
func (*CfxCache) GetGasPrice ¶
type EthCache ¶
type EthCache struct {
EthCacheConfig
// contains filtered or unexported fields
}
EthCache memory cache for some evm space RPC methods
var (
EthDefault *EthCache = newEthCache(newEthCacheConfig())
)
func (*EthCache) AddPendingTransaction ¶
func (*EthCache) Call ¶
func (cache *EthCache) Call( nodeName string, eth *client.RpcEthClient, callRequest types.CallRequest, blockNum *types.BlockNumberOrHash, overrides *types.StateOverride, blockOverrides *types.BlockOverrides, ) (RPCResult, bool, error)
func (*EthCache) CallWithFunc ¶
func (cache *EthCache) CallWithFunc( nodeName string, callRequest types.CallRequest, blockNum *types.BlockNumberOrHash, overrides *types.StateOverride, blockOverrides *types.BlockOverrides, rawGetter func() ([]byte, error), ) (RPCResult, bool, error)
func (*EthCache) GetBlockNumber ¶
func (cache *EthCache) GetBlockNumber( nodeName string, eth *client.RpcEthClient, blockNums ...types.BlockNumber) (*big.Int, bool, error)
func (*EthCache) GetBlockNumberWithFunc ¶
func (*EthCache) GetChainId ¶
func (*EthCache) GetChainIdWithFunc ¶
func (*EthCache) GetClientVersion ¶
func (*EthCache) GetClientVersionWithFunc ¶
func (*EthCache) GetGasPrice ¶
func (*EthCache) GetGasPriceWithFunc ¶
func (*EthCache) GetNetVersion ¶
func (*EthCache) GetNetVersionWithFunc ¶
func (*EthCache) GetPendingTransaction ¶
type EthCacheConfig ¶
type EthCacheConfig struct {
NetVersionExpiration time.Duration `default:"1m"`
ClientVersionExpiration time.Duration `default:"1m"`
ChainIdExpiration time.Duration `default:"8760h"`
BlockNumberExpiration time.Duration `default:"1s"`
PriceExpiration time.Duration `default:"3s"`
CallCacheExpiration time.Duration `default:"1s"`
CallCacheSize int `default:"1024"`
PendingTxnCacheExpiration time.Duration `default:"3m"`
PendingTxnCacheSize int `default:"1024"`
PendingTxnCheckExemption time.Duration `default:"3s"`
PendingTxnCheckInterval time.Duration `default:"1s"`
}
type RPCResult ¶
RPCResult represents the result of an RPC call, containing the response data or a potential JSON-RPC error.
type StatusCache ¶
type StatusCache struct {
// contains filtered or unexported fields
}
StatusCache memory cache for core space status related RPC method suites.
func NewStatusCache ¶
func NewStatusCache() *StatusCache
func (*StatusCache) GetBestBlockHash ¶
func (c *StatusCache) GetBestBlockHash(nodeName string, cfx sdk.ClientOperator) (types.Hash, bool, error)
func (*StatusCache) GetBestBlockHashWithFunc ¶
func (*StatusCache) GetEpochNumber ¶
func (c *StatusCache) GetEpochNumber(nodeName string, cfx sdk.ClientOperator, epoch *types.Epoch) (*hexutil.Big, bool, error)
func (*StatusCache) GetEpochNumberWithFunc ¶
func (*StatusCache) GetStatus ¶
func (c *StatusCache) GetStatus(nodeName string, cfx sdk.ClientOperator) (types.Status, bool, error)
Click to show internal directories.
Click to hide internal directories.