Skip to content

Commit

Permalink
e3: idx range method (ledgerwatch#1028)
Browse files Browse the repository at this point in the history
  • Loading branch information
AskAlexSharov authored Jun 20, 2023
1 parent 9090990 commit 0610e2e
Showing 1 changed file with 19 additions and 24 deletions.
43 changes: 19 additions & 24 deletions state/aggregator_v3.go
Original file line number Diff line number Diff line change
Expand Up @@ -1339,30 +1339,25 @@ func (a *AggregatorV3) EnableMadvNormal() *AggregatorV3 {
return a
}

// -- range
func (ac *AggregatorV3Context) LogAddrRange(addr []byte, startTxNum, endTxNum int, asc order.By, limit int, tx kv.Tx) (iter.U64, error) {
return ac.logAddrs.IdxRange(addr, startTxNum, endTxNum, asc, limit, tx)
}

func (ac *AggregatorV3Context) LogTopicRange(topic []byte, startTxNum, endTxNum int, asc order.By, limit int, tx kv.Tx) (iter.U64, error) {
return ac.logTopics.IdxRange(topic, startTxNum, endTxNum, asc, limit, tx)
}

func (ac *AggregatorV3Context) TraceFromRange(addr []byte, startTxNum, endTxNum int, asc order.By, limit int, tx kv.Tx) (iter.U64, error) {
return ac.tracesFrom.IdxRange(addr, startTxNum, endTxNum, asc, limit, tx)
}

func (ac *AggregatorV3Context) TraceToRange(addr []byte, startTxNum, endTxNum int, asc order.By, limit int, tx kv.Tx) (iter.U64, error) {
return ac.tracesTo.IdxRange(addr, startTxNum, endTxNum, asc, limit, tx)
}
func (ac *AggregatorV3Context) AccountHistoyIdxRange(addr []byte, startTxNum, endTxNum int, asc order.By, limit int, tx kv.Tx) (iter.U64, error) {
return ac.accounts.IdxRange(addr, startTxNum, endTxNum, asc, limit, tx)
}
func (ac *AggregatorV3Context) StorageHistoyIdxRange(addr []byte, startTxNum, endTxNum int, asc order.By, limit int, tx kv.Tx) (iter.U64, error) {
return ac.storage.IdxRange(addr, startTxNum, endTxNum, asc, limit, tx)
}
func (ac *AggregatorV3Context) CodeHistoyIdxRange(addr []byte, startTxNum, endTxNum int, asc order.By, limit int, tx kv.Tx) (iter.U64, error) {
return ac.code.IdxRange(addr, startTxNum, endTxNum, asc, limit, tx)
func (ac *AggregatorV3Context) IndexRange(name kv.InvertedIdx, k []byte, fromTs, toTs int, asc order.By, limit int, tx kv.Tx) (timestamps iter.U64, err error) {
switch name {
case kv.AccountsHistoryIdx:
return ac.accounts.IdxRange(k, fromTs, toTs, asc, limit, tx)
case kv.StorageHistoryIdx:
return ac.storage.IdxRange(k, fromTs, toTs, asc, limit, tx)
case kv.CodeHistoryIdx:
return ac.code.IdxRange(k, fromTs, toTs, asc, limit, tx)
case kv.LogTopicIdx:
return ac.logTopics.IdxRange(k, fromTs, toTs, asc, limit, tx)
case kv.LogAddrIdx:
return ac.logAddrs.IdxRange(k, fromTs, toTs, asc, limit, tx)
case kv.TracesFromIdx:
return ac.tracesFrom.IdxRange(k, fromTs, toTs, asc, limit, tx)
case kv.TracesToIdx:
return ac.tracesTo.IdxRange(k, fromTs, toTs, asc, limit, tx)
default:
return nil, fmt.Errorf("unexpected history name: %s", name)
}
}

// -- range end
Expand Down

0 comments on commit 0610e2e

Please sign in to comment.