Documentation ¶
Index ¶
- Constants
- Variables
- type Backend
- type Cache
- type EthermintBackend
- func (b *EthermintBackend) Block(height *int64) (block *coretypes.ResultBlock, err error)
- func (b *EthermintBackend) BlockNumber() (hexutil.Uint64, error)
- func (b *EthermintBackend) BloomStatus() (uint64, uint64)
- func (b *EthermintBackend) Close()
- func (b *EthermintBackend) ConvertToBlockNumber(blockNumberOrHash rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error)
- func (b *EthermintBackend) GetBlockByHash(hash common.Hash, fullTx bool) (*watcher.Block, error)
- func (b *EthermintBackend) GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (*watcher.Block, error)
- func (b *EthermintBackend) GetBlockHashByHeight(height rpctypes.BlockNumber) (common.Hash, error)
- func (b *EthermintBackend) GetLogs(height int64) ([][]*ethtypes.Log, error)
- func (b *EthermintBackend) GetPendingNonce(address string) (uint64, bool)
- func (b *EthermintBackend) GetRateLimiter(apiName string) *rate.Limiter
- func (b *EthermintBackend) GetTransactionByHash(hash common.Hash) (tx *watcher.Transaction, err error)
- func (b *EthermintBackend) GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error)
- func (b *EthermintBackend) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error)
- func (b *EthermintBackend) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error)
- func (b *EthermintBackend) IsDisabled(apiName string) bool
- func (b *EthermintBackend) LatestBlockNumber() (int64, error)
- func (b *EthermintBackend) LogsLimit() int
- func (b *EthermintBackend) LogsTimeout() time.Duration
- func (b *EthermintBackend) PendingAddressList() ([]string, error)
- func (b *EthermintBackend) PendingTransactionCnt() (int, error)
- func (b *EthermintBackend) PendingTransactions() ([]*watcher.Transaction, error)
- func (b *EthermintBackend) PendingTransactionsByHash(target common.Hash) (*watcher.Transaction, error)
- func (b *EthermintBackend) PruneEverything() bool
- func (b *EthermintBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
- func (b *EthermintBackend) StartBloomHandlers(sectionSize uint64, db dbm.DB)
- func (b *EthermintBackend) UserPendingTransactions(address string, limit int) ([]*watcher.Transaction, error)
- func (b *EthermintBackend) UserPendingTransactionsCnt(address string) (int, error)
- type LruCache
- func (lc *LruCache) AddOrUpdateBlock(hash common.Hash, block *watcher.Block, fullTx bool)
- func (lc *LruCache) AddOrUpdateBlockHash(number uint64, hash common.Hash)
- func (lc *LruCache) AddOrUpdateTransaction(hash common.Hash, tx *watcher.Transaction)
- func (lc *LruCache) GetBlockByHash(hash common.Hash, fullTx bool) (*watcher.Block, error)
- func (lc *LruCache) GetBlockByNumber(number uint64, fullTx bool) (*watcher.Block, error)
- func (lc *LruCache) GetBlockHash(number uint64) (common.Hash, error)
- func (lc *LruCache) GetTransaction(hash common.Hash) (*watcher.Transaction, error)
Constants ¶
const ( FlagLogsLimit = "rpc.logs-limit" FlagLogsTimeout = "rpc.logs-timeout" )
const ( FlagApiBackendBlockLruCache = "rpc-block-cache" FlagApiBackendTxLruCache = "rpc-tx-cache" )
Variables ¶
var ErrLruDataNotFound = errors.New("lru : not found")
var ErrLruDataWrongType = errors.New("lru : wrong type")
var ErrLruNotInitialized = errors.New("lru has not been Initialized")
var ErrTimeout = errors.New("query timeout exceeded")
Functions ¶
This section is empty.
Types ¶
type Backend ¶
type Backend interface { // Used by block filter; also used for polling BlockNumber() (hexutil.Uint64, error) LatestBlockNumber() (int64, error) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error) HeaderByHash(blockHash common.Hash) (*ethtypes.Header, error) GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (*watcher.Block, error) GetBlockByHash(hash common.Hash, fullTx bool) (*watcher.Block, error) GetTransactionByHash(hash common.Hash) (*watcher.Transaction, error) // returns the logs of a given block GetLogs(height int64) ([][]*ethtypes.Log, error) // Used by pending transaction filter PendingTransactions() ([]*watcher.Transaction, error) PendingTransactionCnt() (int, error) PendingTransactionsByHash(target common.Hash) (*watcher.Transaction, error) UserPendingTransactionsCnt(address string) (int, error) UserPendingTransactions(address string, limit int) ([]*watcher.Transaction, error) PendingAddressList() ([]string, error) GetPendingNonce(address string) (uint64, bool) // Used by log filter GetTransactionLogs(txHash common.Hash) ([]*ethtypes.Log, error) BloomStatus() (uint64, uint64) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession) // Used by eip-1898 ConvertToBlockNumber(rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error) // Block returns the block at the given block number, block data is readonly Block(height *int64) (*coretypes.ResultBlock, error) PruneEverything() bool }
Backend implements the functionality needed to filter changes. Implemented by EthermintBackend.
type Cache ¶
type Cache interface { GetBlockByNumber(number uint64, fullTx bool) (*watcher.Block, error) GetBlockByHash(hash common.Hash, fullTx bool) (*watcher.Block, error) AddOrUpdateBlock(hash common.Hash, block *watcher.Block, fullTx bool) GetTransaction(hash common.Hash) (*watcher.Transaction, error) AddOrUpdateTransaction(hash common.Hash, tx *watcher.Transaction) GetBlockHash(number uint64) (common.Hash, error) AddOrUpdateBlockHash(number uint64, hash common.Hash) }
type EthermintBackend ¶
type EthermintBackend struct {
// contains filtered or unexported fields
}
EthermintBackend implements the Backend interface
func New ¶
func New(clientCtx clientcontext.CLIContext, log log.Logger, rateLimiters map[string]*rate.Limiter, disableAPI map[string]bool) *EthermintBackend
New creates a new EthermintBackend instance
func (*EthermintBackend) Block ¶
func (b *EthermintBackend) Block(height *int64) (block *coretypes.ResultBlock, err error)
func (*EthermintBackend) BlockNumber ¶
func (b *EthermintBackend) BlockNumber() (hexutil.Uint64, error)
BlockNumber returns the current block number.
func (*EthermintBackend) BloomStatus ¶
func (b *EthermintBackend) BloomStatus() (uint64, uint64)
BloomStatus returns the BloomBitsBlocks and the number of processed sections maintained by the chain indexer.
func (*EthermintBackend) ConvertToBlockNumber ¶
func (b *EthermintBackend) ConvertToBlockNumber(blockNumberOrHash rpctypes.BlockNumberOrHash) (rpctypes.BlockNumber, error)
func (*EthermintBackend) GetBlockByHash ¶
GetBlockByHash returns the block identified by hash.
func (*EthermintBackend) GetBlockByNumber ¶
func (b *EthermintBackend) GetBlockByNumber(blockNum rpctypes.BlockNumber, fullTx bool) (*watcher.Block, error)
GetBlockByNumber returns the block identified by number.
func (*EthermintBackend) GetBlockHashByHeight ¶
func (b *EthermintBackend) GetBlockHashByHeight(height rpctypes.BlockNumber) (common.Hash, error)
GetBlockHashByHeight returns the block hash by height.
func (*EthermintBackend) GetLogs ¶
func (b *EthermintBackend) GetLogs(height int64) ([][]*ethtypes.Log, error)
GetLogs returns all the logs from all the ethereum transactions in a block.
func (*EthermintBackend) GetPendingNonce ¶
func (b *EthermintBackend) GetPendingNonce(address string) (uint64, bool)
func (*EthermintBackend) GetRateLimiter ¶
func (b *EthermintBackend) GetRateLimiter(apiName string) *rate.Limiter
func (*EthermintBackend) GetTransactionByHash ¶
func (b *EthermintBackend) GetTransactionByHash(hash common.Hash) (tx *watcher.Transaction, err error)
func (*EthermintBackend) GetTransactionLogs ¶
GetTransactionLogs returns the logs given a transaction hash. It returns an error if there's an encoding error. If no logs are found for the tx hash, the error is nil.
func (*EthermintBackend) HeaderByHash ¶
HeaderByHash returns the block header identified by hash.
func (*EthermintBackend) HeaderByNumber ¶
func (b *EthermintBackend) HeaderByNumber(blockNum rpctypes.BlockNumber) (*ethtypes.Header, error)
HeaderByNumber returns the block header identified by height.
func (*EthermintBackend) IsDisabled ¶
func (b *EthermintBackend) IsDisabled(apiName string) bool
func (*EthermintBackend) LatestBlockNumber ¶
func (b *EthermintBackend) LatestBlockNumber() (int64, error)
LatestBlockNumber gets the latest block height in int64 format.
func (*EthermintBackend) LogsLimit ¶
func (b *EthermintBackend) LogsLimit() int
func (*EthermintBackend) LogsTimeout ¶
func (b *EthermintBackend) LogsTimeout() time.Duration
func (*EthermintBackend) PendingAddressList ¶
func (b *EthermintBackend) PendingAddressList() ([]string, error)
func (*EthermintBackend) PendingTransactionCnt ¶
func (b *EthermintBackend) PendingTransactionCnt() (int, error)
func (*EthermintBackend) PendingTransactions ¶
func (b *EthermintBackend) PendingTransactions() ([]*watcher.Transaction, error)
PendingTransactions returns the transactions that are in the transaction pool and have a from address that is one of the accounts this node manages.
func (*EthermintBackend) PendingTransactionsByHash ¶
func (b *EthermintBackend) PendingTransactionsByHash(target common.Hash) (*watcher.Transaction, error)
PendingTransactions returns the transaction that is in the transaction pool and have a from address that is one of the accounts this node manages.
func (*EthermintBackend) PruneEverything ¶
func (b *EthermintBackend) PruneEverything() bool
func (*EthermintBackend) ServiceFilter ¶
func (b *EthermintBackend) ServiceFilter(ctx context.Context, session *bloombits.MatcherSession)
func (*EthermintBackend) StartBloomHandlers ¶
func (b *EthermintBackend) StartBloomHandlers(sectionSize uint64, db dbm.DB)
startBloomHandlers starts a batch of goroutines to accept bloom bit database retrievals from possibly a range of filters and serving the data to satisfy.
func (*EthermintBackend) UserPendingTransactions ¶
func (b *EthermintBackend) UserPendingTransactions(address string, limit int) ([]*watcher.Transaction, error)
func (*EthermintBackend) UserPendingTransactionsCnt ¶
func (b *EthermintBackend) UserPendingTransactionsCnt(address string) (int, error)
type LruCache ¶
type LruCache struct {
// contains filtered or unexported fields
}
func NewLruCache ¶
func NewLruCache() *LruCache
func (*LruCache) AddOrUpdateBlock ¶
func (*LruCache) AddOrUpdateBlockHash ¶
func (*LruCache) AddOrUpdateTransaction ¶
func (lc *LruCache) AddOrUpdateTransaction(hash common.Hash, tx *watcher.Transaction)