Skip to content

Commit 60cbac6

Browse files
db/state: remove unused classes (#19540)
1 parent 94d8e90 commit 60cbac6

File tree

2 files changed

+0
-184
lines changed

2 files changed

+0
-184
lines changed

db/state/aggregator.go

Lines changed: 0 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ import (
3535

3636
"github.com/erigontech/erigon/db/kv/prune"
3737

38-
"github.com/RoaringBitmap/roaring/v2/roaring64"
3938
"github.com/tidwall/btree"
4039
"golang.org/x/sync/errgroup"
4140
"golang.org/x/sync/semaphore"
@@ -47,7 +46,6 @@ import (
4746
"github.com/erigontech/erigon/common/log/v3"
4847
"github.com/erigontech/erigon/db/datadir"
4948
"github.com/erigontech/erigon/db/kv"
50-
"github.com/erigontech/erigon/db/kv/bitmapdb"
5149
"github.com/erigontech/erigon/db/kv/order"
5250
"github.com/erigontech/erigon/db/kv/rawdbv3"
5351
"github.com/erigontech/erigon/db/kv/stream"
@@ -605,37 +603,6 @@ func (a *Aggregator) BuildMissedAccessors(ctx context.Context, workers int) erro
605603
return nil
606604
}
607605

608-
type AggV3Collation struct {
609-
logAddrs map[string]*roaring64.Bitmap
610-
logTopics map[string]*roaring64.Bitmap
611-
tracesFrom map[string]*roaring64.Bitmap
612-
tracesTo map[string]*roaring64.Bitmap
613-
accounts Collation
614-
storage Collation
615-
code Collation
616-
commitment Collation
617-
}
618-
619-
func (c AggV3Collation) Close() {
620-
c.accounts.Close()
621-
c.storage.Close()
622-
c.code.Close()
623-
c.commitment.Close()
624-
625-
for _, b := range c.logAddrs {
626-
bitmapdb.ReturnToPool64(b)
627-
}
628-
for _, b := range c.logTopics {
629-
bitmapdb.ReturnToPool64(b)
630-
}
631-
for _, b := range c.tracesFrom {
632-
bitmapdb.ReturnToPool64(b)
633-
}
634-
for _, b := range c.tracesTo {
635-
bitmapdb.ReturnToPool64(b)
636-
}
637-
}
638-
639606
type AggV3StaticFiles struct {
640607
d [kv.DomainLen]StaticFiles
641608
ivfs []InvertedFiles

db/state/inverted_index_stream.go

Lines changed: 0 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,7 @@ package state
1818

1919
import (
2020
"bytes"
21-
"encoding/binary"
2221

23-
"github.com/RoaringBitmap/roaring/v2/roaring64"
24-
25-
"github.com/erigontech/erigon/db/kv"
26-
"github.com/erigontech/erigon/db/kv/bitmapdb"
2722
"github.com/erigontech/erigon/db/kv/order"
2823
"github.com/erigontech/erigon/db/kv/stream"
2924
"github.com/erigontech/erigon/db/recsplit/multiencseq"
@@ -161,149 +156,3 @@ func (it *InvertedIdxStreamFiles) advanceInFiles() {
161156
it.seqIt = nil // Exhausted this iterator
162157
}
163158
}
164-
165-
// RecentInvertedIdxIter allows iteration over range of txn numbers
166-
// Iteration is not implemented via callback function, because there is often
167-
// a requirement for interators to be composable (for example, to implement AND and OR for indices)
168-
type RecentInvertedIdxIter struct {
169-
key []byte
170-
startTxNum, endTxNum int
171-
limit int
172-
orderAscend order.By
173-
174-
roTx kv.Tx
175-
cursor kv.CursorDupSort
176-
indexTable string
177-
178-
nextN uint64
179-
hasNext bool
180-
err error
181-
182-
bm *roaring64.Bitmap
183-
}
184-
185-
func (it *RecentInvertedIdxIter) Close() {
186-
if it.cursor != nil {
187-
it.cursor.Close()
188-
}
189-
bitmapdb.ReturnToPool64(it.bm)
190-
}
191-
192-
func (it *RecentInvertedIdxIter) advanceInDB() {
193-
var v []byte
194-
var err error
195-
if it.cursor == nil {
196-
if it.cursor, err = it.roTx.CursorDupSort(it.indexTable); err != nil { //nolint:gocritic
197-
// TODO pass error properly around
198-
panic(err)
199-
}
200-
var k []byte
201-
if k, _, err = it.cursor.SeekExact(it.key); err != nil {
202-
panic(err)
203-
}
204-
if k == nil {
205-
it.hasNext = false
206-
return
207-
}
208-
//Asc: [from, to) AND from < to
209-
//Desc: [from, to) AND from > to
210-
var keyBytes [8]byte
211-
if it.startTxNum > 0 {
212-
binary.BigEndian.PutUint64(keyBytes[:], uint64(it.startTxNum))
213-
}
214-
if v, err = it.cursor.SeekBothRange(it.key, keyBytes[:]); err != nil {
215-
panic(err)
216-
}
217-
if v == nil {
218-
if !it.orderAscend {
219-
_, v, err = it.cursor.PrevDup()
220-
if err != nil {
221-
panic(err)
222-
}
223-
}
224-
if v == nil {
225-
it.hasNext = false
226-
return
227-
}
228-
}
229-
} else {
230-
if it.orderAscend {
231-
_, v, err = it.cursor.NextDup()
232-
if err != nil {
233-
// TODO pass error properly around
234-
panic(err)
235-
}
236-
} else {
237-
_, v, err = it.cursor.PrevDup()
238-
if err != nil {
239-
panic(err)
240-
}
241-
}
242-
}
243-
244-
//Asc: [from, to) AND from < to
245-
//Desc: [from, to) AND from > to
246-
if it.orderAscend {
247-
for ; v != nil; _, v, err = it.cursor.NextDup() {
248-
if err != nil {
249-
// TODO pass error properly around
250-
panic(err)
251-
}
252-
n := binary.BigEndian.Uint64(v)
253-
if it.endTxNum >= 0 && int(n) >= it.endTxNum {
254-
it.hasNext = false
255-
return
256-
}
257-
if int(n) >= it.startTxNum {
258-
it.hasNext = true
259-
it.nextN = n
260-
return
261-
}
262-
}
263-
} else {
264-
for ; v != nil; _, v, err = it.cursor.PrevDup() {
265-
if err != nil {
266-
// TODO pass error properly around
267-
panic(err)
268-
}
269-
n := binary.BigEndian.Uint64(v)
270-
if int(n) <= it.endTxNum {
271-
it.hasNext = false
272-
return
273-
}
274-
if it.startTxNum >= 0 && int(n) <= it.startTxNum {
275-
it.hasNext = true
276-
it.nextN = n
277-
return
278-
}
279-
}
280-
}
281-
282-
it.hasNext = false
283-
}
284-
285-
func (it *RecentInvertedIdxIter) advance() {
286-
if it.hasNext {
287-
it.advanceInDB()
288-
}
289-
}
290-
291-
func (it *RecentInvertedIdxIter) HasNext() bool {
292-
if it.err != nil { // always true, then .Next() call will return this error
293-
return true
294-
}
295-
if it.limit == 0 { // limit reached
296-
return false
297-
}
298-
return it.hasNext
299-
}
300-
301-
func (it *RecentInvertedIdxIter) Next() (uint64, error) {
302-
if it.err != nil {
303-
return 0, it.err
304-
}
305-
it.limit--
306-
n := it.nextN
307-
it.advance()
308-
return n, nil
309-
}

0 commit comments

Comments
 (0)