Documentation ¶
Index ¶
- func IsFilterNotFoundError(err error) bool
- func MustNewServerFromViper(handler *handler.EthLogsApiHandler) *rpc.Server
- type Config
- type Filter
- type FilterApi
- func (api *FilterApi) GetFilterChanges(nodeUrl string, id rpc.ID) (interface{}, error)
- func (api *FilterApi) GetFilterLogs(nodeUrl string, id rpc.ID) ([]types.Log, error)
- func (api *FilterApi) NewBlockFilter(nodeUrl string) (rpc.ID, error)
- func (api *FilterApi) NewFilter(nodeUrl string, crit web3Types.FilterQuery) (rpc.ID, error)
- func (api *FilterApi) NewPendingTransactionFilter(nodeUrl string) (rpc.ID, error)
- func (api *FilterApi) UninstallFilter(nodeUrl string, id rpc.ID) (bool, error)
- type FilterSystem
- type FilterType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IsFilterNotFoundError ¶
IsFilterNotFoundError check if error content contains `filter not found`
func MustNewServerFromViper ¶
func MustNewServerFromViper(handler *handler.EthLogsApiHandler) *rpc.Server
MustNewServer creates virtual filters RPC server from viper settings
Types ¶
type Config ¶
type Config struct { Endpoint string `default:":48545"` // server listening endpoint (default: 200) TTL time.Duration `default:":1m"` // how long filters stay active (default: 1min) }
Config represents the configuration of the virtual filter system.
type Filter ¶
type Filter struct {
// contains filtered or unexported fields
}
Filter is a helper struct that holds meta information over the filter type, log filter criterion and proxy full node delegation.
func (*Filter) IsDelegateFullNode ¶
IsDelegateFullNode checks if the filter uses the full node with specified URL as the delegate full node
type FilterApi ¶
type FilterApi struct {
// contains filtered or unexported fields
}
FilterApi offers support to proxy through full nodes to create and manage filters.
func NewFilterApi ¶
func NewFilterApi(system *FilterSystem, ttl time.Duration) *FilterApi
NewFilterApi returns a new FilterApi instance.
func (*FilterApi) GetFilterChanges ¶
GetFilterChanges returns the data for the proxy filter with the given id since last time it was called. This can be used for polling.
func (*FilterApi) GetFilterLogs ¶
GetFilterLogs returns the logs for the proxy filter with the given id.
func (*FilterApi) NewBlockFilter ¶
NewBlockFilter creates a proxy block filter from full node with specified node URL
func (*FilterApi) NewFilter ¶
func (api *FilterApi) NewFilter(nodeUrl string, crit web3Types.FilterQuery) (rpc.ID, error)
NewFilter creates a proxy log filter from full node with specified node URL and filter query condition
func (*FilterApi) NewPendingTransactionFilter ¶
NewPendingTransactionFilter creates a proxy pending txn filter from full node with specified node URL
type FilterSystem ¶
type FilterSystem struct {
// contains filtered or unexported fields
}
FilterSystem creates proxy log filter to fullnode, and instantly polls event logs from the full node to persist data in db or cache for high performance and stable log filter data retrieval service.
func NewFilterSystem ¶
func NewFilterSystem(lhandler *handler.EthLogsApiHandler, conf *Config) *FilterSystem
func (*FilterSystem) GetFilterChanges ¶
func (fs *FilterSystem) GetFilterChanges(w3c *node.Web3goClient, crit *web3Types.FilterQuery) ([]types.Log, error)
GetFilterChanges returns the matching log entries since last polling, and updates the filter cursor accordingly.
func (*FilterSystem) GetFilterLogs ¶
func (fs *FilterSystem) GetFilterLogs(w3c *node.Web3goClient, crit *web3Types.FilterQuery) ([]types.Log, error)
Logs returns the matching log entries from the blockchain node or db/cache store.
type FilterType ¶
type FilterType byte
const ( // log filter, block filter and pending txn filter FilterTypeUnknown FilterType = iota FilterTypeLog FilterTypeBlock FilterTypePendingTxn FilterTypeLastIndex )