filters

package
v1.4.5 Latest Latest
Warning

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

Go to latest
Published: May 24, 2016 License: GPL-3.0 Imports: 16 Imported by: 0

Documentation

Overview

package filters implements an ethereum filtering system for block, transactions and log events.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AccountChange

type AccountChange struct {
	Address, StateAddress []byte
}

type Filter

type Filter struct {
	BlockCallback       func(*types.Block, vm.Logs)
	TransactionCallback func(*types.Transaction)
	LogCallback         func(*vm.Log, bool)
	// contains filtered or unexported fields
}

Filtering interface

func New

func New(db ethdb.Database) *Filter

Create a new filter which uses a bloom filter on blocks to figure out whether a particular block is interesting or not.

func (*Filter) FilterLogs

func (self *Filter) FilterLogs(logs vm.Logs) vm.Logs

func (*Filter) Find

func (self *Filter) Find() vm.Logs

Run filters logs with the current parameters set

func (*Filter) SetAddresses

func (self *Filter) SetAddresses(addr []common.Address)

func (*Filter) SetBeginBlock

func (self *Filter) SetBeginBlock(begin int64)

Set the earliest and latest block for filtering. -1 = latest block (i.e., the current block) hash = particular hash from-to

func (*Filter) SetEndBlock

func (self *Filter) SetEndBlock(end int64)

func (*Filter) SetTopics

func (self *Filter) SetTopics(topics [][]common.Hash)

type FilterSystem

type FilterSystem struct {
	// contains filtered or unexported fields
}

FilterSystem manages filters that filter specific events such as block, transaction and log events. The Filtering system can be used to listen for specific LOG events fired by the EVM (Ethereum Virtual Machine).

func NewFilterSystem

func NewFilterSystem(mux *event.TypeMux) *FilterSystem

NewFilterSystem returns a newly allocated filter manager

func (*FilterSystem) Add

func (fs *FilterSystem) Add(filter *Filter, filterType FilterType) (int, error)

Add adds a filter to the filter manager

func (*FilterSystem) Get

func (fs *FilterSystem) Get(id int) *Filter

func (*FilterSystem) Remove

func (fs *FilterSystem) Remove(id int)

Remove removes a filter by filter id

func (*FilterSystem) Stop

func (fs *FilterSystem) Stop()

Stop quits the filter loop required for polling events

type FilterType added in v1.4.1

type FilterType byte

FilterType determines the type of filter and is used to put the filter in to the correct bucket when added.

const (
	ChainFilter      FilterType = iota // new block events filter
	PendingTxFilter                    // pending transaction filter
	LogFilter                          // new or removed log filter
	PendingLogFilter                   // pending log filter
)

type NewFilterArgs added in v1.4.1

type NewFilterArgs struct {
	FromBlock rpc.BlockNumber
	ToBlock   rpc.BlockNumber
	Addresses []common.Address
	Topics    [][]common.Hash
}

NewFilterArgs represents a request to create a new filter.

func (*NewFilterArgs) UnmarshalJSON added in v1.4.1

func (args *NewFilterArgs) UnmarshalJSON(data []byte) error

UnmarshalJSON sets *args fields with given data.

type PublicFilterAPI added in v1.4.1

type PublicFilterAPI struct {
	// contains filtered or unexported fields
}

PublicFilterAPI offers support to create and manage filters. This will allow external clients to retrieve various information related to the Ethereum protocol such als blocks, transactions and logs.

func NewPublicFilterAPI added in v1.4.1

func NewPublicFilterAPI(chainDb ethdb.Database, mux *event.TypeMux) *PublicFilterAPI

NewPublicFilterAPI returns a new PublicFilterAPI instance.

func (*PublicFilterAPI) GetFilterChanges added in v1.4.1

func (s *PublicFilterAPI) GetFilterChanges(filterId string) interface{}

GetFilterChanges returns the logs for the filter with the given id since last time is was called. This can be used for polling.

func (*PublicFilterAPI) GetFilterLogs added in v1.4.1

func (s *PublicFilterAPI) GetFilterLogs(filterId string) []vmlog

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

func (*PublicFilterAPI) GetLogs added in v1.4.1

func (s *PublicFilterAPI) GetLogs(args NewFilterArgs) []vmlog

GetLogs returns the logs matching the given argument.

func (*PublicFilterAPI) Logs added in v1.4.1

Logs creates a subscription that fires for all new log that match the given filter criteria.

func (*PublicFilterAPI) NewBlockFilter added in v1.4.1

func (s *PublicFilterAPI) NewBlockFilter() (string, error)

NewBlockFilter create a new filter that returns blocks that are included into the canonical chain.

func (*PublicFilterAPI) NewFilter added in v1.4.1

func (s *PublicFilterAPI) NewFilter(args NewFilterArgs) (string, error)

NewFilter creates a new filter and returns the filter id. It can be uses to retrieve logs.

func (*PublicFilterAPI) NewPendingTransactionFilter added in v1.4.1

func (s *PublicFilterAPI) NewPendingTransactionFilter() (string, error)

NewPendingTransactionFilter creates a filter that returns new pending transactions.

func (*PublicFilterAPI) Stop added in v1.4.1

func (s *PublicFilterAPI) Stop()

Stop quits the work loop.

func (*PublicFilterAPI) UninstallFilter added in v1.4.1

func (s *PublicFilterAPI) UninstallFilter(filterId string) bool

UninstallFilter removes the filter with the given filter id.

Jump to

Keyboard shortcuts

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