processor_manager

package
v0.6.5-RC1 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2024 License: AGPL-3.0, AGPL-3.0-or-later Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrCantProcessThisEvent is used when the object is not found
	ErrCantProcessThisEvent = errors.New("not a processor for this event/forkid")
)

Functions

This section is empty.

Types

type L1EventProcessors

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

L1EventProcessors is a manager of L1EventProcessor, it have processor for each forkId and event

  and it could:
	 	- Returns specific processor for a forkId and event (Get function)
  	- Execute a event for a forkId and event (Process function)

To build the object use L1EventProcessorsBuilder

func NewL1EventProcessors

func NewL1EventProcessors() *L1EventProcessors

NewL1EventProcessors returns a empty new L1EventProcessors

func (*L1EventProcessors) Get

Get returns the processor, first try specific, if not wildcard and if not found returns nil

func (*L1EventProcessors) Process

func (p *L1EventProcessors) Process(ctx context.Context, forkId actions.ForkIdType, order etherman.Order, block *etherman.Block, dbTx pgx.Tx) error

Process execute the event for the forkId and event

type L1EventProcessorsBuilder

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

L1EventProcessorsBuilder is a builder for L1EventProcessors how to use:

	p := L1EventProcessorsBuilder{}
	p.Add(etherman.GlobalExitRootsOrder, l1events.NewGlobalExitRootLegacy(state))
 	p.Set....
	return p.Build()

func NewL1EventProcessorsBuilder

func NewL1EventProcessorsBuilder() L1EventProcessorsBuilder

NewL1EventProcessorsBuilder returns a new L1EventProcessorsBuilder instance

func (*L1EventProcessorsBuilder) Build

Build return the L1EventProcessors builded

func (*L1EventProcessorsBuilder) Register

func (p *L1EventProcessorsBuilder) Register(processor actions.L1EventProcessor)

Register register a L1EventProcessor. It ask to the processor the supported forkId and events if there are a previous object register it will panic

func (*L1EventProcessorsBuilder) Set

func (p *L1EventProcessorsBuilder) Set(forkID actions.ForkIdType, event etherman.EventOrder, processor actions.L1EventProcessor, panicIfExists bool)

Set add a L1EventProcessor. If param panicIfExists is true, will panic if already exists the object

the only use to panicIfExists=false is to override a processor in a unitttest

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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