-
-
Notifications
You must be signed in to change notification settings - Fork 75
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Question: Iterator API #105
Comments
I think this suggestion actually mixes two fundamentally different forms of iteration. Instead, it makes more sense to expose two iterators:
The prefix iterator is useful for quick filesystem-like operations on path-like keys, but it's less general than the lexicographic iterator, which is necessary for creating a leveldown. It's worth noting that one could create a prefix iterator out of a lex iterator + correctly encoded keys. That sound like a better approach? As a proof-of-concept, I've thrown this together in a branch that currently powers a (mostly) functional leveldown. |
Quick clarification: Creating the |
As of now the iterator API is
db.iterator(prefix, opts)
, and one of thse opts is a booleangte
, which is fine (and extensive) when results are hash-sorted.With lex-sorted results it makes sense to have
lt
andlte
options, at which point it's odd if those options are strings butgte
is a boolean.I know this is currently an undocumented API that's just used to power
db.list
, but moving forward would it make sense to stay consistent with Level and change the API todb.iterator(opts)
, wheregt
,gte
,lt
andlte
are all string options?The text was updated successfully, but these errors were encountered: