How to implement a reverse roaring bitmap iterator? (sroar.Bitmap.NewReverseIterator went away?)

Hey :wave:

Just to increase visibility, I commented on opt(iterator): Optimise the iterator and introduce range iterators by ahsanbarkati · Pull Request #19 · dgraph-io/sroar · GitHub but perhaps opening it out on the forum is good.

I’m doing some upgrade work and have some code which made use of NewReverseIterator() (from github.com/dgraph-io/sroar) which was removed in opt(iterator): Optimise the iterator and introduce range iterators by ahsanbarkati · Pull Request #19 · dgraph-io/sroar · GitHub.

I am trying to learn how to write a reverse iterator with the new APIs which are NewIterator() and Next() as far as I understand. Does anyone have any tips on how to proceed?

The code in question looks more or less like this:

	if opts.Descending {
		it = resulting.NewReverseIterator()
	} else {
		it = resulting.NewIterator()
	}

	for it.HasNext() {
		v := it.Next()
                ...

Thanks!

PS. Sorry if I got the wrong category, I don’t see something that corresponds to github.com/draph-io/sroar here on the forum? :thinking:

In the meantime… came up with something in chore: upgrade go deps by decentral1se · Pull Request #176 · ssbc/go-ssb · GitHub :+1: Would still love to see a reverse iterator implementation which doesn’t have the additional allocations… afaiu that functionality is lost in that above mentioned PR?