Documentation
¶
Index ¶
- Constants
- func GetDep(deps TxnInputOutput) map[int]map[int]bool
- func HasReadDep(txFrom TxnOutput, txTo TxnInput) bool
- func UpdateDeps(deps map[int]map[int]bool, t TxDep) map[int]map[int]bool
- func ValidateVersion(txIdx int, lastInputOutput *TxnInputOutput, versionedData *MVHashMap) (valid bool)
- type DAG
- type DepsBuilder
- type ErrExecAbortError
- type ExecResult
- type ExecTask
- type ExecVersionView
- type ExecutionStat
- type IntHeap
- type Key
- type MVHashMap
- func (mv *MVHashMap) Delete(k Key, txIdx int)
- func (mv *MVHashMap) FlushMVWriteSet(writes []WriteDescriptor)
- func (mv *MVHashMap) MarkEstimate(k Key, txIdx int)
- func (mv *MVHashMap) Read(k Key, txIdx int) (res MVReadResult)
- func (mv *MVHashMap) ReadStorage(k Key, fallBack func() any) any
- func (mv *MVHashMap) Write(k Key, v Version, data interface{})
- type MVReadResult
- type ParallelExecFailedError
- type ParallelExecutionResult
- type ParallelExecutor
- type PropertyCheck
- type ReadDescriptor
- type SafeFIFOQueue
- type SafePriorityQueue
- type SafeQueue
- type TxBitset
- type TxDep
- type TxReadWriteSet
- type TxnIndexCells
- type TxnInput
- type TxnInputOutput
- func (io *TxnInputOutput) AllWriteSet(txnIdx int) []WriteDescriptor
- func (io *TxnInputOutput) HasWritten(txnIdx int, k Key) bool
- func (io *TxnInputOutput) ReadSet(txnIdx int) []ReadDescriptor
- func (io *TxnInputOutput) RecordAllWriteAtOnce(outputs [][]WriteDescriptor)
- func (io *TxnInputOutput) RecordReadAtOnce(inputs [][]ReadDescriptor)
- func (io *TxnInputOutput) WriteSet(txnIdx int) []WriteDescriptor
- type TxnOutput
- type Version
- type WriteCell
- type WriteDescriptor
Constants ¶
const ( MVReadResultDone = 0 MVReadResultDependency = 1 MVReadResultNone = 2 )
const ( ReadKindMap = 0 ReadKindStorage = 1 )
const FlagDone = 0
const FlagEstimate = 1
const KeyLength = common.AddressLength + common.HashLength + 2
Variables ¶
This section is empty.
Functions ¶
func HasReadDep ¶
HasReadDep checks if there are any read dependencies between two transactions. Performance optimization: Based on production metrics showing ~3M calls with median size of 15 and 95th percentile of 94, we avoid map allocation for small inputs. This optimization leverages the fact that for small lists, linear search is faster than map construction due to avoiding allocation overhead and better cache locality.
func ValidateVersion ¶
func ValidateVersion(txIdx int, lastInputOutput *TxnInputOutput, versionedData *MVHashMap) (valid bool)
Types ¶
type DAG ¶
func BuildDAG ¶
func BuildDAG(deps TxnInputOutput) (d DAG)
func (DAG) LongestPath ¶
func (d DAG) LongestPath(stats map[int]ExecutionStat) ([]int, uint64)
Find the longest execution path in the DAG
type DepsBuilder ¶
type DepsBuilder struct {
// contains filtered or unexported fields
}
DepsBuilder builds a transitive-reduced dependency DAG incrementally. Uses an inverted index (key → latest writer) for O(R) dependency lookups per tx, and bitsets for O(N/64) transitive reduction via word-parallel set operations. Transactions must be added in sequential order (0, 1, 2, ...).
func NewDepsBuilder ¶
func NewDepsBuilder() *DepsBuilder
func (*DepsBuilder) AddTransaction ¶
func (db *DepsBuilder) AddTransaction(index int, readList []ReadDescriptor, writeList []WriteDescriptor) error
AddTransaction records a transaction's read/write sets and computes its reduced dependency set. Must be called with sequential indices (0, 1, 2, ...).
type ErrExecAbortError ¶
func (ErrExecAbortError) Error ¶
func (e ErrExecAbortError) Error() string
type ExecResult ¶
type ExecResult struct {
// contains filtered or unexported fields
}
type ExecTask ¶
type ExecTask interface {
Execute(mvh *MVHashMap, incarnation int) error
MVReadList() []ReadDescriptor
MVWriteList() []WriteDescriptor
MVFullWriteList() []WriteDescriptor
Hash() common.Hash
Sender() common.Address
Settle()
Dependencies() []int
}
type ExecVersionView ¶
type ExecVersionView struct {
// contains filtered or unexported fields
}
func (*ExecVersionView) Execute ¶
func (ev *ExecVersionView) Execute() (er ExecResult)
type ExecutionStat ¶
type Key ¶
func NewAddressKey ¶
func (Key) GetAddress ¶
func (Key) GetStateKey ¶
func (Key) GetSubpath ¶
type MVHashMap ¶
type MVHashMap struct {
// contains filtered or unexported fields
}
func MakeMVHashMap ¶
func MakeMVHashMap() *MVHashMap
func (*MVHashMap) FlushMVWriteSet ¶
func (mv *MVHashMap) FlushMVWriteSet(writes []WriteDescriptor)
func (*MVHashMap) MarkEstimate ¶
type MVReadResult ¶
type MVReadResult struct {
// contains filtered or unexported fields
}
func (*MVReadResult) DepIdx ¶
func (res *MVReadResult) DepIdx() int
func (*MVReadResult) Incarnation ¶
func (res *MVReadResult) Incarnation() int
func (MVReadResult) Status ¶
func (res MVReadResult) Status() int
func (*MVReadResult) Value ¶
func (res *MVReadResult) Value() interface{}
type ParallelExecFailedError ¶
type ParallelExecFailedError struct {
Msg string
}
func (ParallelExecFailedError) Error ¶
func (e ParallelExecFailedError) Error() string
type ParallelExecutionResult ¶
type ParallelExecutionResult struct {
TxIO *TxnInputOutput
Stats *map[int]ExecutionStat
Deps *DAG
AllDeps map[int]map[int]bool
}
func ExecuteParallel ¶
type ParallelExecutor ¶
type ParallelExecutor struct {
// contains filtered or unexported fields
}
func NewParallelExecutor ¶
func NewParallelExecutor(tasks []ExecTask, profile bool, metadata bool, numProcs int) *ParallelExecutor
func (*ParallelExecutor) Close ¶
func (pe *ParallelExecutor) Close(wait bool)
func (*ParallelExecutor) Step ¶
func (pe *ParallelExecutor) Step(res *ExecResult) (result ParallelExecutionResult, err error)
nolint:gocognit
type PropertyCheck ¶
type PropertyCheck func(*ParallelExecutor) error
type ReadDescriptor ¶
type SafeFIFOQueue ¶
type SafeFIFOQueue struct {
// contains filtered or unexported fields
}
func NewSafeFIFOQueue ¶
func NewSafeFIFOQueue(capacity int) *SafeFIFOQueue
func (*SafeFIFOQueue) Len ¶
func (q *SafeFIFOQueue) Len() int
func (*SafeFIFOQueue) Pop ¶
func (q *SafeFIFOQueue) Pop() interface{}
func (*SafeFIFOQueue) Push ¶
func (q *SafeFIFOQueue) Push(v int, d interface{})
type SafePriorityQueue ¶
type SafePriorityQueue struct {
// contains filtered or unexported fields
}
A thread safe priority queue
func NewSafePriorityQueue ¶
func NewSafePriorityQueue(capacity int) *SafePriorityQueue
func (*SafePriorityQueue) Len ¶
func (pq *SafePriorityQueue) Len() int
func (*SafePriorityQueue) Pop ¶
func (pq *SafePriorityQueue) Pop() interface{}
func (*SafePriorityQueue) Push ¶
func (pq *SafePriorityQueue) Push(v int, d interface{})
type TxBitset ¶
type TxBitset struct {
// contains filtered or unexported fields
}
TxBitset is a word-parallel bitset for tracking transaction dependencies. All bitsets operated on together must have the same len(words).
type TxDep ¶
type TxDep struct {
Index int
ReadList []ReadDescriptor
FullWriteList [][]WriteDescriptor
}
type TxReadWriteSet ¶
type TxReadWriteSet struct {
Index int
ReadList []ReadDescriptor
WriteList []WriteDescriptor
}
TxReadWriteSet holds a single transaction's read and write sets for dependency tracking.
type TxnIndexCells ¶
type TxnIndexCells struct {
// contains filtered or unexported fields
}
type TxnInput ¶
type TxnInput []ReadDescriptor
type TxnInputOutput ¶
type TxnInputOutput struct {
// contains filtered or unexported fields
}
func MakeTxnInputOutput ¶
func MakeTxnInputOutput(numTx int) *TxnInputOutput
func (*TxnInputOutput) AllWriteSet ¶
func (io *TxnInputOutput) AllWriteSet(txnIdx int) []WriteDescriptor
func (*TxnInputOutput) HasWritten ¶
func (io *TxnInputOutput) HasWritten(txnIdx int, k Key) bool
func (*TxnInputOutput) ReadSet ¶
func (io *TxnInputOutput) ReadSet(txnIdx int) []ReadDescriptor
func (*TxnInputOutput) RecordAllWriteAtOnce ¶
func (io *TxnInputOutput) RecordAllWriteAtOnce(outputs [][]WriteDescriptor)
func (*TxnInputOutput) RecordReadAtOnce ¶
func (io *TxnInputOutput) RecordReadAtOnce(inputs [][]ReadDescriptor)
func (*TxnInputOutput) WriteSet ¶
func (io *TxnInputOutput) WriteSet(txnIdx int) []WriteDescriptor
type TxnOutput ¶
type TxnOutput []WriteDescriptor