Documentation ¶
Overview ¶
Package logpoller is a service for querying EVM log data.
It can be thought of as a more performant and sophisticated version of eth_getLogs https://ethereum.org/en/developers/docs/apis/json-rpc/#eth_getlogs. Having a local table of relevant, continually canonical logs allows us to 2 main advantages:
- Have hundreds of jobs/clients querying for logs without overloading the underlying RPC provider.
- Do more sophisticated querying (filter by confirmations/time/log contents, efficiently join between the logs table and other tables on the node, etc.)
Guarantees provided by the poller:
- Queries always return the logs from the _current_ canonical chain (same as eth_getLogs). In particular that means that querying unfinalized logs may change between queries but finalized logs remain stable. The threshold between unfinalized and finalized logs is the finalityDepth parameter, chosen such that with exceedingly high probability logs finalityDepth deep cannot be reorged.
- After calling RegisterFilter with a particular event, it will never miss logs for that event despite node crashes and reorgs. The granularity of the filter is always at least one block (more when backfilling).
- Old logs stored in the db will only be deleted if all filters matching them have explicit retention periods set, and all of them have expired. Default retention of 0 on any matching filter guarantees permanent retention.
- After calling Replay(fromBlock), all blocks including that one to the latest chain tip will be polled with the current filter. This can be used on first time job add to specify a start block from which you wish to capture existing logs.
Index ¶
- Variables
- func EvmWord(i uint64) common.Hash
- func FilterName(id string, args ...any) string
- func NewLogPoller(orm ORM, ec Client, lggr logger.Logger, pollPeriod time.Duration, ...) *logPoller
- type Client
- type DbORM
- func (o *DbORM) DeleteBlocksAfter(start int64, qopts ...pg.QOpt) error
- func (o *DbORM) DeleteBlocksBefore(end int64, qopts ...pg.QOpt) error
- func (o *DbORM) DeleteExpiredLogs(qopts ...pg.QOpt) error
- func (o *DbORM) DeleteFilter(name string, qopts ...pg.QOpt) error
- func (o *DbORM) DeleteLogsAfter(start int64, qopts ...pg.QOpt) error
- func (o *DbORM) GetBlocksRange(start uint64, end uint64, qopts ...pg.QOpt) ([]LogPollerBlock, error)
- func (o *DbORM) InsertBlock(h common.Hash, n int64, t time.Time, qopts ...pg.QOpt) error
- func (o *DbORM) InsertFilter(filter Filter, qopts ...pg.QOpt) (err error)
- func (o *DbORM) InsertLogs(logs []Log, qopts ...pg.QOpt) error
- func (o *DbORM) LoadFilters(qopts ...pg.QOpt) (map[string]Filter, error)
- func (o *DbORM) Q() pg.Q
- func (o *DbORM) SelectBlockByHash(h common.Hash, qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *DbORM) SelectBlockByNumber(n int64, qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *DbORM) SelectIndexedLogs(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectIndexedLogsByBlockRange(start, end int64, address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectIndexedLogsByTxHash(eventSig common.Hash, txHash common.Hash, qopts ...pg.QOpt) ([]Log, error)
- func (o *DbORM) SelectIndexedLogsCreatedAfter(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectIndexedLogsTopicGreaterThan(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectIndexedLogsTopicRange(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectIndexedLogsWithSigsExcluding(sigA, sigB common.Hash, topicIndex int, address common.Address, ...) ([]Log, error)
- func (o *DbORM) SelectLatestBlock(qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *DbORM) SelectLatestBlockByEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, ...) (int64, error)
- func (o *DbORM) SelectLatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error)
- func (o *DbORM) SelectLatestLogEventSigsAddrsWithConfs(fromBlock int64, addresses []common.Address, eventSigs []common.Hash, ...) ([]Log, error)
- func (o *DbORM) SelectLogs(start, end int64, address common.Address, eventSig common.Hash, ...) ([]Log, error)
- func (o *DbORM) SelectLogsByBlockRange(start, end int64) ([]Log, error)
- func (o *DbORM) SelectLogsCreatedAfter(address common.Address, eventSig common.Hash, after time.Time, confs int, ...) ([]Log, error)
- func (o *DbORM) SelectLogsDataWordGreaterThan(address common.Address, eventSig common.Hash, wordIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectLogsDataWordRange(address common.Address, eventSig common.Hash, wordIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectLogsUntilBlockHashDataWordGreaterThan(address common.Address, eventSig common.Hash, wordIndex int, ...) ([]Log, error)
- func (o *DbORM) SelectLogsWithSigs(start, end int64, address common.Address, eventSigs []common.Hash, ...) (logs []Log, err error)
- type Exp
- type Filter
- type Log
- type LogPoller
- type LogPollerBlock
- type LogPollerTest
- type ORM
- type ObservedORM
- func (o *ObservedORM) DeleteBlocksAfter(start int64, qopts ...pg.QOpt) error
- func (o *ObservedORM) DeleteBlocksBefore(end int64, qopts ...pg.QOpt) error
- func (o *ObservedORM) DeleteExpiredLogs(qopts ...pg.QOpt) error
- func (o *ObservedORM) DeleteFilter(name string, qopts ...pg.QOpt) error
- func (o *ObservedORM) DeleteLogsAfter(start int64, qopts ...pg.QOpt) error
- func (o *ObservedORM) GetBlocksRange(start uint64, end uint64, qopts ...pg.QOpt) ([]LogPollerBlock, error)
- func (o *ObservedORM) IndexedLogsByTxHash(eventSig common.Hash, txHash common.Hash, qopts ...pg.QOpt) ([]Log, error)
- func (o *ObservedORM) InsertBlock(h common.Hash, n int64, t time.Time, qopts ...pg.QOpt) error
- func (o *ObservedORM) InsertFilter(filter Filter, qopts ...pg.QOpt) error
- func (o *ObservedORM) InsertLogs(logs []Log, qopts ...pg.QOpt) error
- func (o *ObservedORM) LoadFilters(qopts ...pg.QOpt) (map[string]Filter, error)
- func (o *ObservedORM) Q() pg.Q
- func (o *ObservedORM) SelectBlockByNumber(n int64, qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *ObservedORM) SelectIndexedLogs(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectIndexedLogsByBlockRange(start, end int64, address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectIndexedLogsCreatedAfter(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectIndexedLogsTopicGreaterThan(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectIndexedLogsTopicRange(address common.Address, eventSig common.Hash, topicIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectIndexedLogsWithSigsExcluding(sigA, sigB common.Hash, topicIndex int, address common.Address, ...) ([]Log, error)
- func (o *ObservedORM) SelectLatestBlock(qopts ...pg.QOpt) (*LogPollerBlock, error)
- func (o *ObservedORM) SelectLatestBlockByEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, ...) (int64, error)
- func (o *ObservedORM) SelectLatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error)
- func (o *ObservedORM) SelectLatestLogEventSigsAddrsWithConfs(fromBlock int64, addresses []common.Address, eventSigs []common.Hash, ...) ([]Log, error)
- func (o *ObservedORM) SelectLogs(start, end int64, address common.Address, eventSig common.Hash, ...) ([]Log, error)
- func (o *ObservedORM) SelectLogsCreatedAfter(address common.Address, eventSig common.Hash, after time.Time, confs int, ...) ([]Log, error)
- func (o *ObservedORM) SelectLogsDataWordGreaterThan(address common.Address, eventSig common.Hash, wordIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectLogsDataWordRange(address common.Address, eventSig common.Hash, wordIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectLogsUntilBlockHashDataWordGreaterThan(address common.Address, eventSig common.Hash, wordIndex int, ...) ([]Log, error)
- func (o *ObservedORM) SelectLogsWithSigs(start, end int64, address common.Address, eventSigs []common.Hash, ...) ([]Log, error)
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func FilterName ¶
FilterName is a suggested convenience function for clients to construct unique filter names to populate Name field of struct Filter
func NewLogPoller ¶
func NewLogPoller(orm ORM, ec Client, lggr logger.Logger, pollPeriod time.Duration, finalityDepth int64, backfillBatchSize int64, rpcBatchSize int64, keepBlocksDepth int64) *logPoller
NewLogPoller creates a log poller. Note there is an assumption that blocks can be processed faster than they are produced for the given chain, or the poller will fall behind. Block processing involves the following calls in steady state (without reorgs):
- eth_getBlockByNumber - headers only (transaction hashes, not full transaction objects),
- eth_getLogs - get the logs for the block
- 1 db read latest block - for checking reorgs
- 1 db tx including block write and logs write to logs.
How fast that can be done depends largely on network speed and DB, but even for the fastest support chain, polygon, which has 2s block times, we need RPCs roughly with <= 500ms latency
Types ¶
type Client ¶
type Client interface { HeadByNumber(ctx context.Context, n *big.Int) (*evmtypes.Head, error) HeadByHash(ctx context.Context, n common.Hash) (*evmtypes.Head, error) BatchCallContext(ctx context.Context, b []rpc.BatchElem) error FilterLogs(ctx context.Context, q ethereum.FilterQuery) ([]types.Log, error) ConfiguredChainID() *big.Int }
type DbORM ¶ added in v2.7.0
type DbORM struct {
// contains filtered or unexported fields
}
func (*DbORM) DeleteBlocksAfter ¶ added in v2.7.0
DeleteBlocksAfter delete all blocks after and including start.
func (*DbORM) DeleteBlocksBefore ¶ added in v2.7.0
DeleteBlocksBefore delete all blocks before and including end.
func (*DbORM) DeleteExpiredLogs ¶ added in v2.7.0
func (*DbORM) DeleteFilter ¶ added in v2.7.0
DeleteFilter removes all events,address pairs associated with the Filter
func (*DbORM) DeleteLogsAfter ¶ added in v2.7.0
func (*DbORM) GetBlocksRange ¶ added in v2.7.0
func (*DbORM) InsertBlock ¶ added in v2.7.0
InsertBlock is idempotent to support replays.
func (*DbORM) InsertFilter ¶ added in v2.7.0
InsertFilter is idempotent.
Each address/event pair must have a unique job id, so it may be removed when the job is deleted. If a second job tries to overwrite the same pair, this should fail.
func (*DbORM) InsertLogs ¶ added in v2.7.0
InsertLogs is idempotent to support replays.
func (*DbORM) LoadFilters ¶ added in v2.7.0
LoadFiltersForChain returns all filters for this chain
func (*DbORM) SelectBlockByHash ¶ added in v2.7.0
func (*DbORM) SelectBlockByNumber ¶ added in v2.7.0
func (*DbORM) SelectIndexedLogs ¶ added in v2.7.0
func (*DbORM) SelectIndexedLogsByBlockRange ¶ added in v2.7.0
func (o *DbORM) SelectIndexedLogsByBlockRange(start, end int64, address common.Address, eventSig common.Hash, topicIndex int, topicValues []common.Hash, qopts ...pg.QOpt) ([]Log, error)
SelectIndexedLogsByBlockRangeFilter finds the indexed logs in a given block range.
func (*DbORM) SelectIndexedLogsByTxHash ¶ added in v2.7.0
func (*DbORM) SelectIndexedLogsCreatedAfter ¶ added in v2.7.0
func (*DbORM) SelectIndexedLogsTopicGreaterThan ¶ added in v2.7.0
func (*DbORM) SelectIndexedLogsTopicRange ¶ added in v2.7.0
func (*DbORM) SelectIndexedLogsWithSigsExcluding ¶ added in v2.7.0
func (o *DbORM) SelectIndexedLogsWithSigsExcluding(sigA, sigB common.Hash, topicIndex int, address common.Address, startBlock, endBlock int64, confs int, qopts ...pg.QOpt) ([]Log, error)
SelectIndexedLogsWithSigsExcluding query's for logs that have signature A and exclude logs that have a corresponding signature B, matching is done based on the topic index both logs should be inside the block range and have the minimum number of confirmations
func (*DbORM) SelectLatestBlock ¶ added in v2.7.0
func (o *DbORM) SelectLatestBlock(qopts ...pg.QOpt) (*LogPollerBlock, error)
func (*DbORM) SelectLatestBlockByEventSigsAddrsWithConfs ¶ added in v2.7.0
func (o *DbORM) SelectLatestBlockByEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, confs int, qopts ...pg.QOpt) (int64, error)
SelectLatestBlockNumberEventSigsAddrsWithConfs finds the latest block number that matches a list of Addresses and list of events. It returns 0 if there is no matching block
func (*DbORM) SelectLatestLogByEventSigWithConfs ¶ added in v2.7.0
func (*DbORM) SelectLatestLogEventSigsAddrsWithConfs ¶ added in v2.7.0
func (o *DbORM) SelectLatestLogEventSigsAddrsWithConfs(fromBlock int64, addresses []common.Address, eventSigs []common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error)
SelectLatestLogEventSigsAddrsWithConfs finds the latest log by (address, event) combination that matches a list of Addresses and list of events
func (*DbORM) SelectLogs ¶ added in v2.7.0
func (o *DbORM) SelectLogs(start, end int64, address common.Address, eventSig common.Hash, qopts ...pg.QOpt) ([]Log, error)
SelectLogsByBlockRangeFilter finds the logs in a given block range.
func (*DbORM) SelectLogsByBlockRange ¶ added in v2.7.0
func (*DbORM) SelectLogsCreatedAfter ¶ added in v2.7.0
func (o *DbORM) SelectLogsCreatedAfter(address common.Address, eventSig common.Hash, after time.Time, confs int, qopts ...pg.QOpt) ([]Log, error)
SelectLogsCreatedAfter finds logs created after some timestamp.
func (*DbORM) SelectLogsDataWordGreaterThan ¶ added in v2.7.0
func (*DbORM) SelectLogsDataWordRange ¶ added in v2.7.0
func (*DbORM) SelectLogsUntilBlockHashDataWordGreaterThan ¶
func (*DbORM) SelectLogsWithSigs ¶ added in v2.7.0
func (o *DbORM) SelectLogsWithSigs(start, end int64, address common.Address, eventSigs []common.Hash, qopts ...pg.QOpt) (logs []Log, err error)
SelectLogsWithSigsByBlockRangeFilter finds the logs in the given block range with the given event signatures emitted from the given address.
type Filter ¶
type Log ¶
type Log struct { EvmChainId *utils.Big LogIndex int64 BlockHash common.Hash BlockNumber int64 BlockTimestamp time.Time Topics pq.ByteaArray EventSig common.Hash Address common.Address TxHash common.Hash Data []byte CreatedAt time.Time }
Log represents an EVM log.
type LogPoller ¶
type LogPoller interface { services.ServiceCtx Replay(ctx context.Context, fromBlock int64) error ReplayAsync(fromBlock int64) RegisterFilter(filter Filter, qopts ...pg.QOpt) error UnregisterFilter(name string, qopts ...pg.QOpt) error HasFilter(name string) bool LatestBlock(qopts ...pg.QOpt) (int64, error) GetBlocksRange(ctx context.Context, numbers []uint64, qopts ...pg.QOpt) ([]LogPollerBlock, error) // General querying Logs(start, end int64, eventSig common.Hash, address common.Address, qopts ...pg.QOpt) ([]Log, error) LogsWithSigs(start, end int64, eventSigs []common.Hash, address common.Address, qopts ...pg.QOpt) ([]Log, error) LogsCreatedAfter(eventSig common.Hash, address common.Address, time time.Time, confs int, qopts ...pg.QOpt) ([]Log, error) LatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error) LatestLogEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, confs int, qopts ...pg.QOpt) ([]Log, error) LatestBlockByEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, confs int, qopts ...pg.QOpt) (int64, error) // Content based querying IndexedLogs(eventSig common.Hash, address common.Address, topicIndex int, topicValues []common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) IndexedLogsByBlockRange(start, end int64, eventSig common.Hash, address common.Address, topicIndex int, topicValues []common.Hash, qopts ...pg.QOpt) ([]Log, error) IndexedLogsCreatedAfter(eventSig common.Hash, address common.Address, topicIndex int, topicValues []common.Hash, after time.Time, confs int, qopts ...pg.QOpt) ([]Log, error) IndexedLogsByTxHash(eventSig common.Hash, txHash common.Hash, qopts ...pg.QOpt) ([]Log, error) IndexedLogsTopicGreaterThan(eventSig common.Hash, address common.Address, topicIndex int, topicValueMin common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) IndexedLogsTopicRange(eventSig common.Hash, address common.Address, topicIndex int, topicValueMin common.Hash, topicValueMax common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) IndexedLogsWithSigsExcluding(address common.Address, eventSigA, eventSigB common.Hash, topicIndex int, fromBlock, toBlock int64, confs int, qopts ...pg.QOpt) ([]Log, error) LogsDataWordRange(eventSig common.Hash, address common.Address, wordIndex int, wordValueMin, wordValueMax common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) LogsDataWordGreaterThan(eventSig common.Hash, address common.Address, wordIndex int, wordValueMin common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) LogsUntilBlockHashDataWordGreaterThan(eventSig common.Hash, address common.Address, wordIndex int, wordValueMin common.Hash, untilBlockHash common.Hash, qopts ...pg.QOpt) ([]Log, error) }
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 BlockTimestamp time.Time CreatedAt time.Time }
LogPollerBlock represents an unfinalized block used for reorg detection when polling.
type LogPollerTest ¶
type LogPollerTest interface { LogPoller PollAndSaveLogs(ctx context.Context, currentBlockNumber int64) BackupPollAndSaveLogs(ctx context.Context, backupPollerBlockDelay int64) Filter(from, to *big.Int, bh *common.Hash) ethereum.FilterQuery GetReplayFromBlock(ctx context.Context, requested int64) (int64, error) }
type ORM ¶
type ORM interface { Q() pg.Q InsertLogs(logs []Log, qopts ...pg.QOpt) error InsertBlock(h common.Hash, n int64, t time.Time, qopts ...pg.QOpt) error InsertFilter(filter Filter, qopts ...pg.QOpt) error LoadFilters(qopts ...pg.QOpt) (map[string]Filter, error) DeleteFilter(name string, qopts ...pg.QOpt) error DeleteBlocksAfter(start int64, qopts ...pg.QOpt) error DeleteBlocksBefore(end int64, qopts ...pg.QOpt) error DeleteLogsAfter(start int64, qopts ...pg.QOpt) error DeleteExpiredLogs(qopts ...pg.QOpt) error GetBlocksRange(start uint64, end uint64, qopts ...pg.QOpt) ([]LogPollerBlock, error) SelectBlockByNumber(n int64, qopts ...pg.QOpt) (*LogPollerBlock, error) SelectLatestBlock(qopts ...pg.QOpt) (*LogPollerBlock, error) SelectLogs(start, end int64, address common.Address, eventSig common.Hash, qopts ...pg.QOpt) ([]Log, error) SelectLogsWithSigs(start, end int64, address common.Address, eventSigs []common.Hash, qopts ...pg.QOpt) ([]Log, error) SelectLogsCreatedAfter(address common.Address, eventSig common.Hash, after time.Time, confs int, qopts ...pg.QOpt) ([]Log, error) SelectLatestLogByEventSigWithConfs(eventSig common.Hash, address common.Address, confs int, qopts ...pg.QOpt) (*Log, error) SelectLatestLogEventSigsAddrsWithConfs(fromBlock int64, addresses []common.Address, eventSigs []common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) SelectLatestBlockByEventSigsAddrsWithConfs(fromBlock int64, eventSigs []common.Hash, addresses []common.Address, confs int, qopts ...pg.QOpt) (int64, error) SelectIndexedLogs(address common.Address, eventSig common.Hash, topicIndex int, topicValues []common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) SelectIndexedLogsByBlockRange(start, end int64, address common.Address, eventSig common.Hash, topicIndex int, topicValues []common.Hash, qopts ...pg.QOpt) ([]Log, error) SelectIndexedLogsCreatedAfter(address common.Address, eventSig common.Hash, topicIndex int, topicValues []common.Hash, after time.Time, confs int, qopts ...pg.QOpt) ([]Log, error) SelectIndexedLogsTopicGreaterThan(address common.Address, eventSig common.Hash, topicIndex int, topicValueMin common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) SelectIndexedLogsTopicRange(address common.Address, eventSig common.Hash, topicIndex int, topicValueMin, topicValueMax common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) SelectIndexedLogsWithSigsExcluding(sigA, sigB common.Hash, topicIndex int, address common.Address, startBlock, endBlock int64, confs int, qopts ...pg.QOpt) ([]Log, error) SelectIndexedLogsByTxHash(eventSig common.Hash, txHash common.Hash, qopts ...pg.QOpt) ([]Log, error) SelectLogsDataWordRange(address common.Address, eventSig common.Hash, wordIndex int, wordValueMin, wordValueMax common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) SelectLogsDataWordGreaterThan(address common.Address, eventSig common.Hash, wordIndex int, wordValueMin common.Hash, confs int, qopts ...pg.QOpt) ([]Log, error) SelectLogsUntilBlockHashDataWordGreaterThan(address common.Address, eventSig common.Hash, wordIndex int, wordValueMin common.Hash, untilBlockHash common.Hash, qopts ...pg.QOpt) ([]Log, error) }
ORM represents the persistent data access layer used by the log poller. At this moment, it's a bit leaky abstraction, because it exposes some of the database implementation details (e.g. pg.Q). Ideally it should be agnostic and could be applied to any persistence layer. What is more, LogPoller should not be aware of the underlying database implementation and delegate all the queries to the ORM.
type ObservedORM ¶ added in v2.7.0
type ObservedORM struct { ORM // contains filtered or unexported fields }
ObservedORM is a decorator layer for ORM used by LogPoller, responsible for pushing Prometheus metrics reporting duration and size of result set for the queries. It doesn't change internal logic, because all calls are delegated to the origin ORM
func NewObservedORM ¶ added in v2.7.0
NewObservedORM creates an observed version of log poller's ORM created by NewORM Please see ObservedLogPoller for more details on how latencies are measured
func (*ObservedORM) DeleteBlocksAfter ¶ added in v2.7.0
func (o *ObservedORM) DeleteBlocksAfter(start int64, qopts ...pg.QOpt) error
func (*ObservedORM) DeleteBlocksBefore ¶ added in v2.7.0
func (o *ObservedORM) DeleteBlocksBefore(end int64, qopts ...pg.QOpt) error
func (*ObservedORM) DeleteExpiredLogs ¶ added in v2.7.0
func (o *ObservedORM) DeleteExpiredLogs(qopts ...pg.QOpt) error
func (*ObservedORM) DeleteFilter ¶ added in v2.7.0
func (o *ObservedORM) DeleteFilter(name string, qopts ...pg.QOpt) error
func (*ObservedORM) DeleteLogsAfter ¶ added in v2.7.0
func (o *ObservedORM) DeleteLogsAfter(start int64, qopts ...pg.QOpt) error
func (*ObservedORM) GetBlocksRange ¶ added in v2.7.0
func (o *ObservedORM) GetBlocksRange(start uint64, end uint64, qopts ...pg.QOpt) ([]LogPollerBlock, error)
func (*ObservedORM) IndexedLogsByTxHash ¶ added in v2.7.0
func (*ObservedORM) InsertBlock ¶ added in v2.7.0
func (*ObservedORM) InsertFilter ¶ added in v2.7.0
func (o *ObservedORM) InsertFilter(filter Filter, qopts ...pg.QOpt) error
func (*ObservedORM) InsertLogs ¶ added in v2.7.0
func (o *ObservedORM) InsertLogs(logs []Log, qopts ...pg.QOpt) error
func (*ObservedORM) LoadFilters ¶ added in v2.7.0
func (*ObservedORM) Q ¶ added in v2.7.0
func (o *ObservedORM) Q() pg.Q
func (*ObservedORM) SelectBlockByNumber ¶ added in v2.7.0
func (o *ObservedORM) SelectBlockByNumber(n int64, qopts ...pg.QOpt) (*LogPollerBlock, error)
func (*ObservedORM) SelectIndexedLogs ¶ added in v2.7.0
func (*ObservedORM) SelectIndexedLogsByBlockRange ¶ added in v2.7.0
func (*ObservedORM) SelectIndexedLogsCreatedAfter ¶ added in v2.7.0
func (*ObservedORM) SelectIndexedLogsTopicGreaterThan ¶ added in v2.7.0
func (*ObservedORM) SelectIndexedLogsTopicRange ¶ added in v2.7.0
func (*ObservedORM) SelectIndexedLogsWithSigsExcluding ¶ added in v2.7.0
func (*ObservedORM) SelectLatestBlock ¶ added in v2.7.0
func (o *ObservedORM) SelectLatestBlock(qopts ...pg.QOpt) (*LogPollerBlock, error)