virtualfilter

package
v1.0.5-mainnet Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsFilterNotFoundError

func IsFilterNotFoundError(err error) bool

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

func (f *Filter) IsDelegateFullNode(nodeUrl string) bool

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(nodeUrl string, id rpc.ID) (interface{}, 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

func (api *FilterApi) GetFilterLogs(nodeUrl string, id rpc.ID) ([]types.Log, error)

GetFilterLogs returns the logs for the proxy filter with the given id.

func (*FilterApi) NewBlockFilter

func (api *FilterApi) NewBlockFilter(nodeUrl string) (rpc.ID, error)

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

func (api *FilterApi) NewPendingTransactionFilter(nodeUrl string) (rpc.ID, error)

NewPendingTransactionFilter creates a proxy pending txn filter from full node with specified node URL

func (*FilterApi) UninstallFilter

func (api *FilterApi) UninstallFilter(nodeUrl string, id rpc.ID) (bool, error)

UninstallFilter removes the proxy filter with the given filter id.

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
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL