oe

package
v0.50.6 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func WithAbortRate

func WithAbortRate(rate int) func(*OptimisticExecution)

WithAbortRate sets the abort rate for the OE. The abort rate is a number from 0 to 100 that determines the percentage of OE that should be aborted. This is for testing purposes only and must not be used in production.

Types

type FinalizeBlockFunc

FinalizeBlockFunc is the function that is called by the OE to finalize the block. It is the same as the one in the ABCI app.

type OptimisticExecution

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

OptimisticExecution is a struct that contains the OE context. It is used to run the FinalizeBlock function in a goroutine, and to abort it if needed.

func NewOptimisticExecution

func NewOptimisticExecution(logger log.Logger, fn FinalizeBlockFunc, opts ...func(*OptimisticExecution)) *OptimisticExecution

NewOptimisticExecution initializes the Optimistic Execution context but does not start it.

func (*OptimisticExecution) Abort

func (oe *OptimisticExecution) Abort()

Abort aborts the OE unconditionally and waits for it to finish.

func (*OptimisticExecution) AbortIfNeeded

func (oe *OptimisticExecution) AbortIfNeeded(reqHash []byte) bool

AbortIfNeeded aborts the OE if the request hash is not the same as the one in the running OE. Returns true if the OE was aborted.

func (*OptimisticExecution) Enabled

func (oe *OptimisticExecution) Enabled() bool

func (*OptimisticExecution) Execute

Execute initializes the OE and starts it in a goroutine.

func (*OptimisticExecution) Initialized

func (oe *OptimisticExecution) Initialized() bool

Initialized returns true if the OE was initialized, meaning that it contains a request and it was run or it is running.

func (*OptimisticExecution) Reset

func (oe *OptimisticExecution) Reset()

Reset resets the OE context. Must be called whenever we want to invalidate the current OE.

func (*OptimisticExecution) WaitResult

func (oe *OptimisticExecution) WaitResult() (*abci.ResponseFinalizeBlock, error)

WaitResult waits for the OE to finish and returns the result.

Jump to

Keyboard shortcuts

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