eventprocessor

package
v1.0.1-beta-4 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MIT, Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	BlockFailedExecutionBackoff time.Duration
	DedupExecutedTxns           bool
	HashCalcStep                int64
}

Config contains configuration attributes for an event processor.

func DefaultConfig

func DefaultConfig() *Config

DefaultConfig returns the default configuration.

type EventProcessor

type EventProcessor interface {
	GetLastExecutedBlockNumber() int64
	Start() error
	Stop()
}

EventProcessor processes events from a smart-contract.

type Option

type Option func(*Config) error

Option modifies a configuration attribute.

func WithBlockFailedExecutionBackoff

func WithBlockFailedExecutionBackoff(backoff time.Duration) Option

WithBlockFailedExecutionBackoff provides a sleep duration between retryiable executions. e.g: if execution block events fails due to the underlying database being unavailable, we'll wait this time before retrying.

func WithDedupExecutedTxns

func WithDedupExecutedTxns(dedupExecutedTxns bool) Option

WithDedupExecutedTxns makes the event processor skip executing txn hashes that have already been executed before. **IMPORTANT NOTE**: This is an unsafe flag that should only be enabled in test environments. A txn hash should never appear again after it was executed since that indicates there was a reorg in the chain.

func WithHashCalcStep

func WithHashCalcStep(step int64) Option

WithHashCalcStep determines the pace of state hash calculations. The hash will be calculated for every block equal or greater to the next multiple of the step.

type Receipt

type Receipt struct {
	ChainID      tableland.ChainID
	BlockNumber  int64
	IndexInBlock int64
	TxnHash      string

	TableID       *tables.TableID
	Error         *string
	ErrorEventIdx *int
}

Receipt is an event receipt.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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