Documentation ¶
Index ¶
- func BuildPackedBlock(block *types.Block, txs []*db.PackedTransaction) *db.PackedBlock
- func BuildPackedTx(tx *types.Transaction, sender common.Address, receipt *types.Receipt) *db.PackedTransaction
- func FetchBlockByHash(client *ethclient.Client, hash common.Hash, number string, _db *gorm.DB, ...) bool
- func FetchBlockByNumber(client *ethclient.Client, number uint64, _db *gorm.DB, redis *d.RedisInfo, ...) bool
- func FetchTransactionByHash(client *ethclient.Client, block *types.Block, tx *types.Transaction, ...)
- func FindMissingBlocksInRange(found []uint64, from uint64, to uint64) []uint64
- func ProcessBlockContent(client *ethclient.Client, block *types.Block, _db *gorm.DB, redis *d.RedisInfo, ...) bool
- func PublishBlock(block *db.PackedBlock, redis *d.RedisInfo) bool
- func PublishEvent(blockNumber uint64, event *db.Events, redis *d.RedisInfo) bool
- func PublishEvents(blockNumber uint64, events []*db.Events, redis *d.RedisInfo) bool
- func PublishTx(blockNumber uint64, tx *db.PackedTransaction, redis *d.RedisInfo) bool
- func PublishTxs(blockNumber uint64, txs []*db.PackedTransaction, redis *d.RedisInfo) bool
- func RetryQueueManager(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, ...)
- func SubscribeToNewBlocks(connection *d.BlockChainNodeConnection, _db *gorm.DB, status *d.StatusHolder, ...)
- func SyncBlocksByRange(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, ...)
- func SyncMissingBlocksInDB(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, ...)
- func Syncer(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, ...)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func BuildPackedBlock ¶ added in v1.2.0
func BuildPackedBlock(block *types.Block, txs []*db.PackedTransaction) *db.PackedBlock
BuildPackedBlock - Builds struct holding whole block data i.e. block header, block body i.e. tx(s), event log(s)
func BuildPackedTx ¶ added in v1.2.0
func BuildPackedTx(tx *types.Transaction, sender common.Address, receipt *types.Receipt) *db.PackedTransaction
BuildPackedTx - Putting all information, `ette` will keep for one tx into a single structure, so that it becomes easier to pass to & from functions
func FetchBlockByHash ¶ added in v1.2.0
func FetchBlockByHash(client *ethclient.Client, hash common.Hash, number string, _db *gorm.DB, redis *d.RedisInfo, queue *q.BlockProcessorQueue, _status *d.StatusHolder) bool
FetchBlockByHash - Fetching block content using blockHash
func FetchBlockByNumber ¶ added in v1.2.0
func FetchBlockByNumber(client *ethclient.Client, number uint64, _db *gorm.DB, redis *d.RedisInfo, publishable bool, queue *q.BlockProcessorQueue, _status *d.StatusHolder) bool
FetchBlockByNumber - Fetching block content using block number
func FetchTransactionByHash ¶ added in v1.2.0
func FetchTransactionByHash(client *ethclient.Client, block *types.Block, tx *types.Transaction, _db *gorm.DB, redis *d.RedisInfo, publishable bool, _status *d.StatusHolder, returnValChan chan *db.PackedTransaction)
FetchTransactionByHash - Fetching specific transaction related data, tries to publish data if required & lets listener go routine know about all tx, event data it collected while processing this tx, which will be attempted to be stored in database
func FindMissingBlocksInRange ¶ added in v1.6.0
FindMissingBlocksInRange - Given ascending ordered block numbers read from DB attempts to find out which numbers are missing in [from, to] range where both ends are inclusive
func ProcessBlockContent ¶ added in v1.2.0
func ProcessBlockContent(client *ethclient.Client, block *types.Block, _db *gorm.DB, redis *d.RedisInfo, publishable bool, queue *q.BlockProcessorQueue, status *d.StatusHolder, startingAt time.Time) bool
ProcessBlockContent - Processes everything inside this block i.e. block data, tx data, event data
func PublishBlock ¶ added in v1.2.0
func PublishBlock(block *db.PackedBlock, redis *d.RedisInfo) bool
PublishBlock - Attempts to publish block data to Redis pubsub channel
func PublishEvent ¶ added in v1.2.0
PublishEvent - Publishing event/ log entry to redis pub-sub topic, to be captured by subscribers and sent to client application, who are interested in this piece of data after applying filter
func PublishEvents ¶ added in v1.2.0
PublishEvents - Iterate over all events & try to publish them on redis pubsub channel
func PublishTx ¶ added in v1.2.0
PublishTx - Publishes tx & events in tx, related data to respective Redis pubsub channel
func PublishTxs ¶ added in v1.2.0
PublishTxs - Publishes all transactions in a block to redis pubsub channel
func RetryQueueManager ¶ added in v1.3.0
func RetryQueueManager(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, queue *q.BlockProcessorQueue, status *d.StatusHolder)
RetryQueueManager - Pop oldest block number from Redis backed retry queue & try to fetch it in different go routine
Sleeps for 1000 milliseconds ¶
Keeps repeating
func SubscribeToNewBlocks ¶
func SubscribeToNewBlocks(connection *d.BlockChainNodeConnection, _db *gorm.DB, status *d.StatusHolder, redis *d.RedisInfo, queue *q.BlockProcessorQueue)
SubscribeToNewBlocks - Listen for event when new block header is available, then fetch block content ( including all transactions ) in different worker
func SyncBlocksByRange ¶
func SyncBlocksByRange(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, queue *q.BlockProcessorQueue, fromBlock uint64, toBlock uint64, status *d.StatusHolder)
SyncBlocksByRange - Fetch & persist all blocks in range(fromBlock, toBlock), both inclusive
Range can be either ascending or descending, depending upon that proper arguments to be passed to `Syncer` function during invokation
func SyncMissingBlocksInDB ¶
func SyncMissingBlocksInDB(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, queue *q.BlockProcessorQueue, status *d.StatusHolder)
SyncMissingBlocksInDB - Checks with database for what blocks are present & what are not, fetches missing blocks & related data iteratively
func Syncer ¶
func Syncer(client *ethclient.Client, _db *gorm.DB, redis *d.RedisInfo, queue *q.BlockProcessorQueue, fromBlock uint64, toBlock uint64, status *d.StatusHolder, jd func(*workerpool.WorkerPool, *d.Job, *q.BlockProcessorQueue))
Syncer - Given ascending block number range i.e. fromBlock <= toBlock attempts to fetch missing blocks in that range while running n workers concurrently, where n = number of cores this machine has
Waits for all of them to complete
Types ¶
This section is empty.