Documentation ¶
Index ¶
- type Log
- type LogPoller
- func (lp *LogPoller) Close() error
- func (lp *LogPoller) LatestBlock(qopts ...pg.QOpt) (int64, error)
- func (lp *LogPoller) LatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error)
- func (lp *LogPoller) Logs(start, end int64, eventSig common.Hash, address common.Address, ...) ([]Log, error)
- func (lp *LogPoller) MergeFilter(topics []common.Hash, address common.Address)
- func (lp *LogPoller) Replay(ctx context.Context, fromBlock int64) error
- func (lp *LogPoller) Start(parentCtx context.Context) error
- type LogPollerBlock
- type ORM
- func (o *ORM) DeleteLogs(start, end int64, qopts ...pg.QOpt) error
- func (o *ORM) DeleteRangeBlocks(start, end int64, qopts ...pg.QOpt) error
- func (o *ORM) InsertBlock(h common.Hash, n int64, qopts ...pg.QOpt) error
- func (o *ORM) InsertLogs(logs []Log, qopts ...pg.QOpt) error
- func (o *ORM) SelectBlockByHash(h common.Hash, qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *ORM) SelectBlockByNumber(n int64, qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *ORM) SelectLatestBlock(qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *ORM) SelectLatestLogEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error)
- func (o *ORM) SelectLogsByBlockRangeFilter(start, end int64, address common.Address, eventSig []byte, qopts ...pg.QOpt) ([]Log, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Log ¶
type Log struct { EvmChainId *utils.Big LogIndex int64 BlockHash common.Hash BlockNumber int64 Topics pq.ByteaArray EventSig []byte Address common.Address TxHash common.Hash Data []byte CreatedAt time.Time }
Log represents an EVM log.
type LogPoller ¶
type LogPoller struct { utils.StartStopOnce // contains filtered or unexported fields }
func NewLogPoller ¶
func (*LogPoller) LatestLogByEventSigWithConfs ¶
func (lp *LogPoller) LatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error)
LatestLogByEventSigWithConfs finds the latest log that has confs number of blocks on top of the log.
func (*LogPoller) Logs ¶
func (lp *LogPoller) Logs(start, end int64, eventSig common.Hash, address common.Address, qopts ...pg.QOpt) ([]Log, error)
Logs returns logs matching topics and address (exactly) in the given block range, which are canonical at time of query.
func (*LogPoller) MergeFilter ¶
MergeFilter will update the filter with the new topics and addresses. Clients may chose to MergeFilter and then replay in order to ensure desired logs are present.
type LogPollerBlock ¶
type LogPollerBlock struct { EvmChainId *utils.Big BlockHash common.Hash // Note geth uses int64 internally https://github.com/ethereum/go-ethereum/blob/f66f1a16b3c480d3a43ac7e8a09ab3e362e96ae4/eth/filters/api.go#L340 BlockNumber int64 CreatedAt time.Time }
LogPollerBlock represents an unfinalized block used for reorg detection when polling.
type ORM ¶
type ORM struct {
// contains filtered or unexported fields
}
func (*ORM) DeleteRangeBlocks ¶
func (*ORM) InsertBlock ¶
InsertBlock is idempotent to support replays.
func (*ORM) InsertLogs ¶
InsertLogs is idempotent to support replays.
func (*ORM) SelectBlockByHash ¶
func (*ORM) SelectBlockByNumber ¶
func (*ORM) SelectLatestBlock ¶
func (o *ORM) SelectLatestBlock(qopts ...pg.QOpt) (*LogPollerBlock, error)
func (*ORM) SelectLatestLogEventSigWithConfs ¶
func (*ORM) SelectLogsByBlockRangeFilter ¶
func (o *ORM) SelectLogsByBlockRangeFilter(start, end int64, address common.Address, eventSig []byte, qopts ...pg.QOpt) ([]Log, error)
SelectLogsByBlockRangeFilter finds the latest logs by block. Assumes that logs inserted later for a given block are "more" canonical.