mirror of
https://gitlab.com/pulsechaincom/erigon-pulse.git
synced 2025-01-10 04:51:20 +00:00
19 lines
618 B
Go
19 lines
618 B
Go
package bitmapdb
|
|
|
|
import (
|
|
"github.com/RoaringBitmap/roaring/roaring64"
|
|
)
|
|
|
|
type BitmapStream struct {
|
|
bm *roaring64.Bitmap
|
|
it roaring64.IntPeekable64
|
|
}
|
|
|
|
func NewBitmapStream(bm *roaring64.Bitmap) *BitmapStream {
|
|
return &BitmapStream{bm: bm, it: bm.Iterator()}
|
|
}
|
|
func (it *BitmapStream) HasNext() bool { return it.it.HasNext() }
|
|
func (it *BitmapStream) Close() { ReturnToPool64(it.bm) }
|
|
func (it *BitmapStream) Next() (uint64, error) { return it.it.Next(), nil }
|
|
func (it *BitmapStream) ToBitmap() (*roaring64.Bitmap, error) { return it.bm, nil }
|