logprovider

package
v2.7.2-beta0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2023 License: MIT Imports: 29 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	LogProviderServiceName = "LogEventProvider"

	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
	// MaxPayloads is the maximum number of payloads to return per call.
	MaxPayloads = 100
)
View Source
var (
	// LogRetention is the amount of time to retain logs for.
	LogRetention = 24 * time.Hour
	// LogBackfillBuffer is the number of blocks from the latest block for which backfill is done when adding a filter in log poller
	LogBackfillBuffer = 100
)
View Source
var (
	LogRecovererServiceName = "LogRecoverer"

	// RecoveryInterval is the interval at which the recovery scanning processing is triggered
	RecoveryInterval = 5 * time.Second
	// RecoveryCacheTTL is the time to live for the recovery cache
	RecoveryCacheTTL = 10 * time.Minute
	// GCInterval is the interval at which the recovery cache is cleaned up
	GCInterval = RecoveryCacheTTL - time.Second
	// MaxProposals is the maximum number of proposals that can be returned by GetRecoveryProposals
	MaxProposals = 20
)

Functions

func New

func New(lggr logger.Logger, poller logpoller.LogPoller, c client.Client, stateStore core.UpkeepStateReader, finalityDepth uint32) (LogEventProvider, LogRecoverer)

New creates a new log event provider and recoverer. using default values for the options.

func NewLogEventsPacker

func NewLogEventsPacker() *logEventsPacker

func NewLogProvider added in v2.5.0

func NewLogProvider(lggr logger.Logger, poller logpoller.LogPoller, packer LogDataPacker, filterStore UpkeepFilterStore, opts LogTriggersOptions) *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, opts LogTriggersOptions) *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 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(ctx context.Context, opts FilterOptions) error
	// UnregisterFilter removes the filter for the given upkeepID.
	UnregisterFilter(upkeepID *big.Int) error
}

type LogTriggersOptions added in v2.6.0

type LogTriggersOptions struct {
	// LookbackBlocks is the number of blocks the provider will look back for logs.
	// The recoverer will scan for logs up to this depth.
	// NOTE: MUST be set to a greater-or-equal to the chain's finality depth.
	LookbackBlocks int64
	// ReadInterval is the interval to fetch logs in the background.
	ReadInterval time.Duration
	// 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
	// Finality depth is the number of blocks to wait before considering a block final.
	FinalityDepth int64
}

LogTriggersOptions holds the options for the log trigger components.

func NewOptions added in v2.6.0

func NewOptions(finalityDepth int64) LogTriggersOptions

func (*LogTriggersOptions) Defaults added in v2.6.0

func (o *LogTriggersOptions) Defaults(finalityDepth int64)

Defaults sets the default values for the options. NOTE: o.LookbackBlocks should be set only from within tests

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