Documentation
¶
Index ¶
- func WithAbortRate[T transaction.Tx](rate int) func(*OptimisticExecution[T])
- type FinalizeBlockFunc
- type FinalizeBlockResponse
- type OptimisticExecution
- func (oe *OptimisticExecution[T]) Abort()
- func (oe *OptimisticExecution[T]) AbortIfNeeded(reqHash []byte) bool
- func (oe *OptimisticExecution[T]) Execute(req *abci.ProcessProposalRequest)
- func (oe *OptimisticExecution[T]) Initialized() bool
- func (oe *OptimisticExecution[T]) Reset()
- func (oe *OptimisticExecution[T]) WaitResult() (*FinalizeBlockResponse[T], error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func WithAbortRate ¶
func WithAbortRate[T transaction.Tx](rate int) func(*OptimisticExecution[T])
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 ¶
type FinalizeBlockFunc[T transaction.Tx] func(context.Context, *abci.FinalizeBlockRequest) (*server.BlockResponse, store.WriterMap, []T, error)
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 FinalizeBlockResponse ¶
type FinalizeBlockResponse[T transaction.Tx] struct { Resp *server.BlockResponse StateChanges store.WriterMap DecodedTxs []T }
type OptimisticExecution ¶
type OptimisticExecution[T transaction.Tx] 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[T transaction.Tx](logger log.Logger, fn FinalizeBlockFunc[T], opts ...func(*OptimisticExecution[T])) *OptimisticExecution[T]
NewOptimisticExecution initializes the Optimistic Execution context but does not start it.
func (*OptimisticExecution[T]) Abort ¶
func (oe *OptimisticExecution[T]) Abort()
Abort aborts the OE unconditionally and waits for it to finish.
func (*OptimisticExecution[T]) AbortIfNeeded ¶
func (oe *OptimisticExecution[T]) 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[T]) Execute ¶
func (oe *OptimisticExecution[T]) Execute(req *abci.ProcessProposalRequest)
Execute initializes the OE and starts it in a goroutine.
func (*OptimisticExecution[T]) Initialized ¶
func (oe *OptimisticExecution[T]) 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[T]) Reset ¶
func (oe *OptimisticExecution[T]) Reset()
Reset resets the OE context. Must be called whenever we want to invalidate the current OE.
func (*OptimisticExecution[T]) WaitResult ¶
func (oe *OptimisticExecution[T]) WaitResult() (*FinalizeBlockResponse[T], error)
WaitResult waits for the OE to finish and returns the result.