Documentation ¶
Index ¶
- func WithAbortRate(rate int) func(*OptimisticExecution)
- type FinalizeBlockFunc
- type OptimisticExecution
- func (oe *OptimisticExecution) Abort()
- func (oe *OptimisticExecution) AbortIfNeeded(reqHash []byte) bool
- func (oe *OptimisticExecution) Enabled() bool
- func (oe *OptimisticExecution) Execute(req *abci.RequestProcessProposal)
- func (oe *OptimisticExecution) Initialized() bool
- func (oe *OptimisticExecution) Reset()
- func (oe *OptimisticExecution) WaitResult() (*abci.ResponseFinalizeBlock, error)
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 ¶
type FinalizeBlockFunc func(context.Context, *abci.RequestFinalizeBlock) (*abci.ResponseFinalizeBlock, 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 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 ¶
func (oe *OptimisticExecution) Execute(req *abci.RequestProcessProposal)
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.