exec

package
v1.17.11 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBlockUndo = errors.New("block undone")
View Source
var ErrNoInput = errors.New("no input")

var Timer time.Duration

View Source
var ErrSkippableOutput = errors.New("skippable output") // willfully skippable output (through intrinsic)
View Source
var MaxUndoneBlocksSize = 100

Functions

func RunModule

func RunModule(ctx context.Context, executor ModuleExecutor, execOutput execout.ExecutionOutputGetter, cachable bool) (*pbssinternal.ModuleOutput, []byte, []byte, bool, bool, error)

RunModule returns:

  • moduleOutput: the structured data
  • outputBytes: the marshalled version of moduleOutput
  • outputBytesFiles: the marshalled bytes to be sent to a file,
  • skippedExecution: an indication that execution was not performed (skipped from index or skipped because it has no input -- cached data does not count as skipped, but marks the moduleOuput as 'Cached')
  • skippableOutput: an indication that the output can be skipped
  • error: an error

Types

type BaseExecutor

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

func NewBaseExecutor

func NewBaseExecutor(
	ctx context.Context,
	moduleName, moduleHash string,
	initialBlock uint64,
	wasmModule wasm.Module,
	cacheEnabled bool,
	wasmArguments []wasm.Argument,
	blockIndex *index.BlockIndex,
	entrypoint string,
	tracer ttrace.Tracer,
	foundationalStores []pbservice.StoreClient,
) *BaseExecutor

func (*BaseExecutor) BlockIndex added in v1.6.0

func (e *BaseExecutor) BlockIndex() *index.BlockIndex

func (*BaseExecutor) Close added in v1.1.5

func (e *BaseExecutor) Close(ctx context.Context) error

func (*BaseExecutor) RunsOnBlock added in v1.6.0

func (e *BaseExecutor) RunsOnBlock(blockNum uint64) bool

type ErrorExecutor

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

func (*ErrorExecutor) Error

func (e *ErrorExecutor) Error() string

type ExecutionStages added in v1.6.0

type ExecutionStages []StageLayers

A list of units that we can schedule, that might include some mappers and a store, or the last module could be an exeuction layer with only a map.

func (ExecutionStages) LastStage added in v1.6.0

func (e ExecutionStages) LastStage() StageLayers

type Graph added in v1.6.0

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

func NewOutputModuleGraph added in v1.6.0

func NewOutputModuleGraph(outputModule string, productionMode bool, modules *pbsubstreams.Modules, firstStreamableBlock uint64) (out *Graph, err error)

func TestGraphStagedModules added in v1.6.0

func TestGraphStagedModules(initialBlock1, ib2, ib3, ib4, ib5 uint64) *Graph

func TestNew added in v1.6.0

func TestNew() *Graph

func (*Graph) AncestorsFrom added in v1.6.0

func (g *Graph) AncestorsFrom(moduleName string) []string

func (*Graph) IsOutputModule added in v1.6.0

func (g *Graph) IsOutputModule(name string) bool

func (*Graph) LowestInitBlock added in v1.6.0

func (g *Graph) LowestInitBlock() uint64

func (*Graph) LowestStoresInitBlock added in v1.6.0

func (g *Graph) LowestStoresInitBlock() *uint64

func (*Graph) ModuleHashes added in v1.6.0

func (g *Graph) ModuleHashes() map[string]string

func (*Graph) ModulesInitBlocks added in v1.6.0

func (g *Graph) ModulesInitBlocks() map[string]uint64

func (*Graph) OutputModule added in v1.6.0

func (g *Graph) OutputModule() *pbsubstreams.Module

func (*Graph) OutputModuleStageIndex added in v1.8.0

func (g *Graph) OutputModuleStageIndex() int

func (*Graph) SchedulableModuleNames added in v1.6.0

func (g *Graph) SchedulableModuleNames() []string

func (*Graph) StagedUsedModules added in v1.6.0

func (g *Graph) StagedUsedModules() ExecutionStages

func (*Graph) Stores added in v1.6.0

func (g *Graph) Stores() []*pbsubstreams.Module

func (*Graph) UsedIndexModules added in v1.6.0

func (g *Graph) UsedIndexModules() []*pbsubstreams.Module

func (*Graph) UsedIndexesModulesUpToStage added in v1.6.0

func (g *Graph) UsedIndexesModulesUpToStage(stage int) (out []*pbsubstreams.Module)

func (*Graph) UsedModules added in v1.6.0

func (g *Graph) UsedModules() []*pbsubstreams.Module

func (*Graph) UsedModulesUpToStage added in v1.6.0

func (g *Graph) UsedModulesUpToStage(stage int) (out []*pbsubstreams.Module)

func (*Graph) UsedStoreModules added in v1.17.9

func (g *Graph) UsedStoreModules() []*pbsubstreams.Module

func (*Graph) ValidateRequestStartBlock added in v1.6.0

func (g *Graph) ValidateRequestStartBlock(requestStartBlockNum uint64) error

type IndexModuleExecutor added in v1.6.0

type IndexModuleExecutor struct {
	BaseExecutor
}

func NewIndexModuleExecutor added in v1.6.0

func NewIndexModuleExecutor(baseExecutor *BaseExecutor) *IndexModuleExecutor

func (*IndexModuleExecutor) HasOutputForFiles added in v1.6.0

func (i *IndexModuleExecutor) HasOutputForFiles() bool

func (*IndexModuleExecutor) HasValidOutput added in v1.6.0

func (i *IndexModuleExecutor) HasValidOutput() bool

func (*IndexModuleExecutor) Name added in v1.6.0

func (i *IndexModuleExecutor) Name() string

func (*IndexModuleExecutor) String added in v1.6.0

func (i *IndexModuleExecutor) String() string

type LayerModules added in v1.6.0

type LayerModules []*pbsubstreams.Module

The list of modules in a given layer of either maps or stores. A given layer will always be comprised of only the same kind of modules.

func (LayerModules) IsStoreLayer added in v1.6.0

func (l LayerModules) IsStoreLayer() bool

type MapperModuleExecutor

type MapperModuleExecutor struct {
	BaseExecutor
	// contains filtered or unexported fields
}

func NewMapperModuleExecutor

func NewMapperModuleExecutor(baseExecutor *BaseExecutor, outputType string) *MapperModuleExecutor

func (*MapperModuleExecutor) HasOutputForFiles added in v1.6.0

func (e *MapperModuleExecutor) HasOutputForFiles() bool

func (*MapperModuleExecutor) HasValidOutput added in v0.1.0

func (e *MapperModuleExecutor) HasValidOutput() bool

func (*MapperModuleExecutor) Name

func (e *MapperModuleExecutor) Name() string

Name implements ModuleExecutor

func (*MapperModuleExecutor) String

func (e *MapperModuleExecutor) String() string

type ModuleExecutor

type ModuleExecutor interface {
	// Name returns the name of the module as defined in the manifest.
	Name() string
	String() string
	Close(ctx context.Context) error

	HasValidOutput() bool
	HasOutputForFiles() bool

	BlockIndex() *index.BlockIndex
	RunsOnBlock(blockNum uint64) bool
	// contains filtered or unexported methods
}

type SharedCache added in v1.13.0

type SharedCache struct {
	sync.Mutex
	// contains filtered or unexported fields
}
var GlobalSharedCache *SharedCache

func NewSharedCache added in v1.13.0

func NewSharedCache(sizeBlocks uint64) *SharedCache

func (*SharedCache) Cachable added in v1.13.0

func (s *SharedCache) Cachable(blockNum uint64) bool

func (*SharedCache) Execute added in v1.13.0

func (s *SharedCache) Execute(
	originalContext context.Context,
	wasmModule wasm.Module,
	moduleHash string,
	call *wasm.Call,
	wasmArguments []wasm.Argument,
	argValues map[string][]byte,
	undoManager *UndoManager,
) error

func (*SharedCache) ProcessBlock added in v1.13.0

func (s *SharedCache) ProcessBlock(blk *pbbstream.Block, _ interface{}) error

type StageLayers added in v1.6.0

type StageLayers []LayerModules

For a given execution stage, the layers of execution, for example: a layer of mappers, followed by a layer of stores.

func (StageLayers) IsLastStage added in v1.6.0

func (l StageLayers) IsLastStage() bool

func (StageLayers) LastLayer added in v1.6.0

func (l StageLayers) LastLayer() LayerModules

type StoreModuleExecutor

type StoreModuleExecutor struct {
	BaseExecutor
	// contains filtered or unexported fields
}

func NewStoreModuleExecutor

func NewStoreModuleExecutor(baseExecutor *BaseExecutor, outputStore store.DeltaAccessor) *StoreModuleExecutor

func (*StoreModuleExecutor) HasOutputForFiles added in v1.6.0

func (e *StoreModuleExecutor) HasOutputForFiles() bool

func (*StoreModuleExecutor) HasValidOutput added in v0.1.0

func (e *StoreModuleExecutor) HasValidOutput() bool

func (*StoreModuleExecutor) Name

func (e *StoreModuleExecutor) Name() string

func (*StoreModuleExecutor) String

func (e *StoreModuleExecutor) String() string

type UndoManager added in v1.16.2

type UndoManager struct {
	sync.Mutex
	// contains filtered or unexported fields
}

UndoManager gives cancelable contexts as subscriptions to specific block hashes. if that blocks gets an UNDO signal from a reorg, it will cancel that context.

var GlobalUndoManager *UndoManager

func NewUndoManager added in v1.16.2

func NewUndoManager() *UndoManager

func (*UndoManager) Contains added in v1.16.2

func (u *UndoManager) Contains(id string) bool

func (*UndoManager) ProcessBlock added in v1.16.2

func (u *UndoManager) ProcessBlock(blk *pbbstream.Block, obj any) error

func (*UndoManager) Subscribe added in v1.16.2

func (u *UndoManager) Subscribe(ctx context.Context, blockID string) (context.Context, func())

Subscribe returns a context that will get canceled if the block with the given ID gets previousUndoneBlocks returns an unsubscribe function that must be called to prevent leaks

Jump to

Keyboard shortcuts

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