Documentation ¶
Index ¶
- Variables
- func MustInitFromViper()
- type CfxCache
- func (cache *CfxCache) GetClientVersion(cfx sdk.ClientOperator) (string, bool, error)
- func (cache *CfxCache) GetClientVersionWithFunc(rawGetter func() (interface{}, error)) (string, bool, error)
- func (cache *CfxCache) GetGasPrice(cfx sdk.ClientOperator) (*hexutil.Big, bool, error)
- func (cache *CfxCache) GetGasPriceWithFunc(rawGetter func() (interface{}, error)) (*hexutil.Big, bool, error)
- type EthCache
- func (cache *EthCache) Call(nodeName string, client *web3go.Client, callRequest types.CallRequest, ...) (RPCResult, bool, error)
- func (cache *EthCache) CallWithFunc(nodeName string, rawGetter func() (interface{}, error), ...) (RPCResult, bool, error)
- func (cache *EthCache) GetBlockNumber(nodeName string, client *web3go.Client) (*hexutil.Big, bool, error)
- func (cache *EthCache) GetBlockNumberWithFunc(nodeName string, rawGetter func() (interface{}, error)) (*hexutil.Big, bool, error)
- func (cache *EthCache) GetChainId(client *web3go.Client) (*hexutil.Uint64, bool, error)
- func (cache *EthCache) GetChainIdWithFunc(rawGetter func() (interface{}, error)) (*hexutil.Uint64, bool, error)
- func (cache *EthCache) GetClientVersion(client *web3go.Client) (string, bool, error)
- func (cache *EthCache) GetClientVersionWithFunc(rawGetter func() (interface{}, error)) (string, bool, error)
- func (cache *EthCache) GetGasPrice(client *web3go.Client) (*hexutil.Big, bool, error)
- func (cache *EthCache) GetGasPriceWithFunc(rawGetter func() (interface{}, error)) (*hexutil.Big, bool, error)
- func (cache *EthCache) GetNetVersion(client *web3go.Client) (string, bool, error)
- func (cache *EthCache) GetNetVersionWithFunc(rawGetter func() (interface{}, error)) (string, bool, error)
- 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() (interface{}, 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, rawGetter func() (interface{}, error), 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() (interface{}, 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 {
// contains filtered or unexported fields
}
EthCache memory cache for some evm space RPC methods
var (
EthDefault *EthCache = newEthCache(newEthCacheConfig())
)
func (*EthCache) CallWithFunc ¶
func (cache *EthCache) CallWithFunc( nodeName string, rawGetter func() (interface{}, error), callRequest types.CallRequest, blockNum *types.BlockNumberOrHash, ) (RPCResult, bool, error)
func (*EthCache) GetBlockNumber ¶
func (*EthCache) GetBlockNumberWithFunc ¶
func (*EthCache) GetChainId ¶
func (*EthCache) GetChainIdWithFunc ¶
func (*EthCache) GetClientVersion ¶
func (*EthCache) GetClientVersionWithFunc ¶
func (*EthCache) GetGasPrice ¶
func (*EthCache) GetGasPriceWithFunc ¶
func (*EthCache) GetNetVersion ¶
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:"128"` }
type RPCResult ¶
type RPCResult struct { Data interface{} RpcError error }
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)
func (*StatusCache) GetStatusWithFunc ¶
Click to show internal directories.
Click to hide internal directories.