Documentation ¶
Index ¶
- func IsFilterNotFoundError(err error) bool
- func MustNewServerFromViper(shutdownContext util.GracefulShutdownContext, ...) (*rpc.Server, string)
- type Config
- type DelegateFilterID
- type Filter
- type FilterApi
- func (api *FilterApi) GetFilterChanges(id rpc.ID) (res *types.FilterChanges, err error)
- func (api *FilterApi) GetFilterLogs(id rpc.ID) (logs []types.Log, err error)
- func (api *FilterApi) NewBlockFilter(nodeUrl string) (rpc.ID, error)
- func (api *FilterApi) NewFilter(nodeUrl string, crit types.FilterQuery) (rpc.ID, error)
- func (api *FilterApi) NewPendingTransactionFilter(nodeUrl string) (rpc.ID, error)
- func (api *FilterApi) UninstallFilter(id rpc.ID) (bool, error)
- type FilterBlock
- type FilterChain
- func (fc *FilterChain) Back() *FilterNode
- func (fc *FilterChain) Extend(extended *list.List) error
- func (fc *FilterChain) Front() *FilterNode
- func (fc *FilterChain) Merge(changes *types.FilterChanges) error
- func (fc *FilterChain) PushBack(block *FilterBlock) *FilterNode
- func (fc *FilterChain) PushFront(block *FilterBlock) *FilterNode
- func (fc *FilterChain) Reorg(reverted *list.List) error
- func (fc *FilterChain) Rewind(node *FilterNode) error
- func (fc *FilterChain) SnapshotCurrentCursor() FilterCursor
- func (fc *FilterChain) Traverse(cursor FilterCursor, iterator FilterChainIteratorFunc) error
- type FilterChainIteratorFunc
- type FilterContext
- type FilterCursor
- type FilterNode
- type FilterSystem
- func (fs *FilterSystem) GetFilterChanges(id web3rpc.ID) (*types.FilterChanges, error)
- func (fs *FilterSystem) GetFilterLogs(id web3rpc.ID) ([]types.Log, error)
- func (fs *FilterSystem) NewFilter(client *node.Web3goClient, crit *types.FilterQuery) (*web3rpc.ID, error)
- func (fs *FilterSystem) UninstallFilter(id web3rpc.ID) (bool, error)
- type FilterType
- type ProxyFilterID
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( shutdownContext util.GracefulShutdownContext, vfls *mysql.VirtualFilterLogStore, handler *handler.EthLogsApiHandler, ) (*rpc.Server, string)
MustServeFromViper creates virtual filters RPC server from viper settings
Types ¶
type Config ¶
type Config struct { Endpoint string `default:":48545"` // server listening endpoint (default: :48545) TTL time.Duration `default:"1m"` // how long filters stay active (default: 1min) // max number of filter blocks full of event logs to restrict memory usage (default: 100) MaxFullFilterBlocks int `default:"100"` }
Config represents the configuration of the virtual filter system.
type DelegateFilterID ¶
type DelegateFilterID = rpc.ID // delegate filter ID
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 ¶
func (api *FilterApi) GetFilterChanges(id rpc.ID) (res *types.FilterChanges, err error)
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 types.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
func (*FilterApi) UninstallFilter ¶
UninstallFilter removes the proxy filter with the given filter id.
type FilterBlock ¶
type FilterBlock struct { FilterCursor // contains filtered or unexported fields }
FilterBlock virtual filter block with event logs inside.
func NewFilterBlockFromLog ¶
func NewFilterBlockFromLog(log *types.Log) *FilterBlock
func (*FilterBlock) AppendLogs ¶
func (fb *FilterBlock) AppendLogs(logs ...types.Log)
func (*FilterBlock) Match ¶
func (fb *FilterBlock) Match(block *FilterBlock) bool
type FilterChain ¶
type FilterChain struct {
// contains filtered or unexported fields
}
FilterChain simulates a virtual filter blockchain
func NewFilterChain ¶
func NewFilterChain(maxFilterBlocks int) *FilterChain
func (*FilterChain) Back ¶
func (fc *FilterChain) Back() *FilterNode
Back returns the last node of the filter chain or nil if the chain is empty.
func (*FilterChain) Front ¶
func (fc *FilterChain) Front() *FilterNode
Front returns the first node of the filter chain or nil if the chain is empty.
func (*FilterChain) Merge ¶
func (fc *FilterChain) Merge(changes *types.FilterChanges) error
func (*FilterChain) PushBack ¶
func (fc *FilterChain) PushBack(block *FilterBlock) *FilterNode
PushFront inserts new node at the back of the chain and returns it
func (*FilterChain) PushFront ¶
func (fc *FilterChain) PushFront(block *FilterBlock) *FilterNode
PushFront inserts new node at the front of the chain and returns it
func (*FilterChain) Rewind ¶
func (fc *FilterChain) Rewind(node *FilterNode) error
Rewind reverts the canonical chain to the specified node
func (*FilterChain) SnapshotCurrentCursor ¶
func (fc *FilterChain) SnapshotCurrentCursor() FilterCursor
SnapshotCurrentCursor snapshots the latest cursor
func (*FilterChain) Traverse ¶
func (fc *FilterChain) Traverse(cursor FilterCursor, iterator FilterChainIteratorFunc) error
Traverse traverses the filter chain from some specified cursor
type FilterChainIteratorFunc ¶
type FilterChainIteratorFunc func(node *FilterNode, forkPoint bool) bool
type FilterContext ¶
type FilterContext struct {
// contains filtered or unexported fields
}
FilterContext stores information for filter such as query criterion etc.
type FilterCursor ¶
type FilterCursor struct {
// contains filtered or unexported fields
}
FilterCursor the visiting position where last polling ends.
type FilterNode ¶
type FilterNode struct { *FilterBlock // contains filtered or unexported fields }
FilterNode chain node which wraps block and link info
func (*FilterNode) Next ¶
func (n *FilterNode) Next() *FilterNode
Next returns the next chain node or nil.
func (*FilterNode) Prev ¶
func (n *FilterNode) Prev() *FilterNode
Prev returns the previous chain node or nil.
type FilterSystem ¶
type FilterSystem struct {
// contains filtered or unexported fields
}
FilterSystem creates proxy log filter to full node, and instantly polls event logs from the full node to persist data in db/cache store for high performance and stable log filter data retrieval service.
func NewFilterSystem ¶
func NewFilterSystem( shutdownCtx cmdutil.GracefulShutdownContext, vfls *mysql.VirtualFilterLogStore, lhandler *handler.EthLogsApiHandler, conf *Config, ) *FilterSystem
func (*FilterSystem) GetFilterChanges ¶
func (fs *FilterSystem) GetFilterChanges(id web3rpc.ID) (*types.FilterChanges, error)
GetFilterChanges returns the matching log entries since last polling, and updates the filter cursor accordingly.
func (*FilterSystem) GetFilterLogs ¶
Logs returns the matching log entries from the blockchain node or db/cache store.
func (*FilterSystem) NewFilter ¶
func (fs *FilterSystem) NewFilter(client *node.Web3goClient, crit *types.FilterQuery) (*web3rpc.ID, error)
NewFilter creates a new virtual delegate filter
func (*FilterSystem) UninstallFilter ¶
func (fs *FilterSystem) UninstallFilter(id web3rpc.ID) (bool, error)
UninstallFilter uninstalls a virtual delegate filter
type FilterType ¶
type FilterType byte
const ( // log filter, block filter and pending txn filter FilterTypeUnknown FilterType = iota FilterTypeLog FilterTypeBlock FilterTypePendingTxn FilterTypeLastIndex )
type ProxyFilterID ¶
type ProxyFilterID = rpc.ID // proxy filter ID