logprovider

package
v2.5.0-rc0 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// AllowedLogsPerBlock is the maximum number of logs allowed per upkeep in a block.
	AllowedLogsPerBlock = 128
	// BufferMaxBlockSize is the maximum number of blocks in the buffer.
	BufferMaxBlockSize = 1024
)
View Source
var (
	ErrHeadNotAvailable   = fmt.Errorf("head not available")
	ErrBlockLimitExceeded = fmt.Errorf("block limit exceeded")

	// AllowedLogsPerUpkeep is the maximum number of logs allowed per upkeep every single call.
	AllowedLogsPerUpkeep = 5
)
View Source
var (
	ErrNotFound             = errors.New("not found")
	DefaultRecoveryInterval = 5 * time.Second
	// TODO: Reduce these intervals to allow sending same proposals again if they were not fulfilled
	RecoveryCacheTTL = 24*time.Hour - time.Second
	GCInterval       = time.Hour
)
View Source
var (
	// LogRetention is the amount of time to retain logs for.
	LogRetention = 24 * time.Hour
)

Functions

func New

func NewLogEventsPacker

func NewLogEventsPacker(utilsABI abi.ABI) *logEventsPacker

func NewLogProvider added in v2.5.0

func NewLogProvider(lggr logger.Logger, poller logpoller.LogPoller, packer LogDataPacker, filterStore UpkeepFilterStore, opts *LogEventProviderOptions) *logEventProvider

func NewLogRecoverer added in v2.5.0

func NewLogRecoverer(lggr logger.Logger, poller logpoller.LogPoller, client client.Client, stateStore core.UpkeepStateReader, packer LogDataPacker, filterStore UpkeepFilterStore, interval time.Duration, lookbackBlocks int64) *logRecoverer

func NewUpkeepFilterStore added in v2.5.0

func NewUpkeepFilterStore() *upkeepFilterStore

Types

type FilterOptions added in v2.5.0

type FilterOptions struct {
	UpkeepID      *big.Int
	TriggerConfig LogTriggerConfig
	UpdateBlock   uint64
}

type LogDataPacker

type LogDataPacker interface {
	PackLogData(log logpoller.Log) ([]byte, error)
}

type LogEventProvider

type LogEventProvider interface {
	ocr2keepers.LogEventProvider
	LogTriggersLifeCycle

	RefreshActiveUpkeeps(ids ...*big.Int) ([]*big.Int, error)

	Start(context.Context) error
	io.Closer
}

type LogEventProviderOptions

type LogEventProviderOptions struct {
	// LookbackBlocks is the number of blocks to look back for logs.
	LookbackBlocks int64
	// ReorgBuffer is the number of blocks to add as a buffer to the lookback.
	ReorgBuffer int64
	// BlockRateLimit is the rate limit on the range of blocks the we fetch logs for.
	BlockRateLimit rate.Limit
	// BlockLimitBurst is the burst upper limit on the range of blocks the we fetch logs for.
	BlockLimitBurst int
	// ReadInterval is the interval to fetch logs in the background.
	ReadInterval time.Duration
	// ReadBatchSize is the max number of items in one read batch / partition.
	ReadBatchSize int
	// Readers is the number of reader workers to spawn.
	Readers int
}

LogEventProviderOptions holds the options for the log event provider.

func (*LogEventProviderOptions) Defaults

func (o *LogEventProviderOptions) Defaults()

Defaults sets the default values for the options.

type LogEventProviderTest

type LogEventProviderTest interface {
	LogEventProvider
	ReadLogs(ctx context.Context, ids ...*big.Int) error
	CurrentPartitionIdx() uint64
}

type LogRecoverer added in v2.5.0

type LogTriggerConfig

type LogTriggerConfig automation_utils_2_1.LogTriggerConfig

LogTriggerConfig is an alias for log trigger config.

type LogTriggersLifeCycle added in v2.5.0

type LogTriggersLifeCycle interface {
	// RegisterFilter registers the filter (if valid) for the given upkeepID.
	RegisterFilter(opts FilterOptions) error
	// UnregisterFilter removes the filter for the given upkeepID.
	UnregisterFilter(upkeepID *big.Int) error
}

type UpkeepFilterStore added in v2.5.0

type UpkeepFilterStore interface {
	GetIDs(selector func(upkeepFilter) bool) []*big.Int
	UpdateFilters(updater func(upkeepFilter, upkeepFilter) upkeepFilter, filters ...upkeepFilter)
	Has(id *big.Int) bool
	Get(id *big.Int) *upkeepFilter
	RangeFiltersByIDs(iterator func(int, upkeepFilter), ids ...*big.Int)
	GetFilters(selector func(upkeepFilter) bool) []upkeepFilter
	AddActiveUpkeeps(filters ...upkeepFilter)
	RemoveActiveUpkeeps(filters ...upkeepFilter)
	Size() int
}

Jump to

Keyboard shortcuts

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