impl

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2023 License: MIT, Apache-2.0 Imports: 28 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type EventFeed

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

EventFeed provides a stream of filtered events from a SC.

func New

New returns a new EventFeed.

func (*EventFeed) Start

func (ef *EventFeed) Start(
	ctx context.Context,
	fromHeight int64,
	ch chan<- eventfeed.BlockEvents,
	filterEventTypes []eventfeed.EventType,
) error

Start sends a stream of filtered events from a smart contract since `fromHeight` to the provided channel. This is a blocking call, which the caller must cancel the provided context to shut down gracefully the feed. The received channel won't be closed.

type EventFeedStore added in v1.3.0

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

EventFeedStore is the storage layer for EventFeed.

func NewEventFeedStore added in v1.3.0

func NewEventFeedStore(db *database.SQLiteDB) *EventFeedStore

NewEventFeedStore creates a new feed store.

func (*EventFeedStore) AreEVMEventsPersisted added in v1.3.0

func (s *EventFeedStore) AreEVMEventsPersisted(
	ctx context.Context, chainID tableland.ChainID, txnHash common.Hash,
) (bool, error)

AreEVMEventsPersisted returns true if there're events persisted for the provided txn hash, and false otherwise.

func (*EventFeedStore) Begin added in v1.3.0

func (s *EventFeedStore) Begin() (*sql.Tx, error)

Begin starts a tx.

func (*EventFeedStore) GetBlockExtraInfo added in v1.3.0

func (s *EventFeedStore) GetBlockExtraInfo(
	ctx context.Context, chainID tableland.ChainID, blockNumber int64,
) (eventfeed.EVMBlockInfo, error)

GetBlockExtraInfo info returns stored information about an EVM block.

func (*EventFeedStore) GetBlocksMissingExtraInfo added in v1.3.0

func (s *EventFeedStore) GetBlocksMissingExtraInfo(
	ctx context.Context, chainID tableland.ChainID, lastKnownHeight *int64,
) ([]int64, error)

GetBlocksMissingExtraInfo returns a list of block numbers that don't contain enhanced information. It receives an optional fromHeight to only look for blocks after a block number. If null it will look for blocks at any height.

func (*EventFeedStore) GetEVMEvents added in v1.3.0

func (s *EventFeedStore) GetEVMEvents(
	ctx context.Context, chainID tableland.ChainID, txnHash common.Hash,
) ([]eventfeed.EVMEvent, error)

GetEVMEvents returns all the persisted events for a transaction.

func (*EventFeedStore) InsertBlockExtraInfo added in v1.3.0

func (s *EventFeedStore) InsertBlockExtraInfo(
	ctx context.Context, chainID tableland.ChainID, blockNumber int64, timestamp uint64,
) error

InsertBlockExtraInfo inserts enhanced information for a block.

func (*EventFeedStore) SaveEVMEvents added in v1.3.0

func (s *EventFeedStore) SaveEVMEvents(
	ctx context.Context, chainID tableland.ChainID, events []eventfeed.EVMEvent,
) error

SaveEVMEvents saves the provider EVMEvents.

func (*EventFeedStore) WithTx added in v1.3.0

func (s *EventFeedStore) WithTx(tx *sql.Tx) eventfeed.EventFeedStore

WithTx returns an EventFeedStore with a tx attached.

type InstrutmentedEventFeedStore added in v1.3.0

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

InstrutmentedEventFeedStore is the intrumented storage layer for EventFeed.

func NewInstrumentedEventFeedStore added in v1.3.0

func NewInstrumentedEventFeedStore(db *database.SQLiteDB) (*InstrutmentedEventFeedStore, error)

NewInstrumentedEventFeedStore creates a new feed store.

func (*InstrutmentedEventFeedStore) AreEVMEventsPersisted added in v1.3.0

func (s *InstrutmentedEventFeedStore) AreEVMEventsPersisted(
	ctx context.Context, chainID tableland.ChainID, txnHash common.Hash,
) (bool, error)

AreEVMEventsPersisted returns true if there're events persisted for the provided txn hash, and false otherwise.

func (*InstrutmentedEventFeedStore) Begin added in v1.3.0

func (s *InstrutmentedEventFeedStore) Begin() (*sql.Tx, error)

Begin starts a tx.

func (*InstrutmentedEventFeedStore) GetBlockExtraInfo added in v1.3.0

func (s *InstrutmentedEventFeedStore) GetBlockExtraInfo(
	ctx context.Context, chainID tableland.ChainID, blockNumber int64,
) (eventfeed.EVMBlockInfo, error)

GetBlockExtraInfo info returns stored information about an EVM block.

func (*InstrutmentedEventFeedStore) GetBlocksMissingExtraInfo added in v1.3.0

func (s *InstrutmentedEventFeedStore) GetBlocksMissingExtraInfo(
	ctx context.Context, chainID tableland.ChainID, lastKnownHeight *int64,
) ([]int64, error)

GetBlocksMissingExtraInfo returns a list of block numbers that don't contain enhanced information. It receives an optional fromHeight to only look for blocks after a block number. If null it will look for blocks at any height.

func (*InstrutmentedEventFeedStore) GetEVMEvents added in v1.3.0

func (s *InstrutmentedEventFeedStore) GetEVMEvents(
	ctx context.Context, chainID tableland.ChainID, txnHash common.Hash,
) ([]eventfeed.EVMEvent, error)

GetEVMEvents returns all the persisted events for a transaction.

func (*InstrutmentedEventFeedStore) InsertBlockExtraInfo added in v1.3.0

func (s *InstrutmentedEventFeedStore) InsertBlockExtraInfo(
	ctx context.Context, chainID tableland.ChainID, blockNumber int64, timestamp uint64,
) error

InsertBlockExtraInfo inserts enhanced information for a block.

func (*InstrutmentedEventFeedStore) SaveEVMEvents added in v1.3.0

func (s *InstrutmentedEventFeedStore) SaveEVMEvents(
	ctx context.Context, chainID tableland.ChainID, events []eventfeed.EVMEvent,
) error

SaveEVMEvents saves the provider EVMEvents.

func (*InstrutmentedEventFeedStore) WithTx added in v1.3.0

WithTx returns an EventFeedStore with a tx attached.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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