mafintosh / hyperdb

Distributed scalable database
MIT License
753 stars 75 forks source link

Iterator should support `reverse` option #107

Closed andrewosh closed 6 years ago

andrewosh commented 6 years ago

I'm working through some issues with using hyperdb as a leveldown backend (https://github.com/andrewosh/hyperdbdown). #105 + #97 + #104 should cover most of the remaining features/issues, but an efficient approach to reverse iteration would also be expected.

Any thoughts on how to tackle this? I'm scratching my head a bit -- as it stands, the DFS trie search doesn't seem very amenable to reverse iteration, but maybe there's "one simple trick" I'm not seeing.

andrewosh commented 6 years ago

Also connected to #75 but with important differences

mafintosh commented 6 years ago

@andrewosh if you just flip the current sort order wouldn't it be reverse? :thinking:

andrewosh commented 6 years ago

Well hey that's a helluva simple trick ;) #111 Somehow had convinced myself that wouldn't work.

e-e-e commented 6 years ago

@andrewosh I also shared the same intuition as you. It's great that its so simple.

mafintosh commented 6 years ago

you fixed this in latest! :)