Skip to content
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

Get a range in one go #98

Closed
kesla opened this issue May 13, 2014 · 6 comments
Closed

Get a range in one go #98

kesla opened this issue May 13, 2014 · 6 comments
Labels
discussion Discussion

Comments

@kesla
Copy link
Contributor

kesla commented May 13, 2014

Working with #96 got me thinking that we might have the opportunity here to add the functionality to get a range in one go.

The proposed API would then look something like this:

// where opts can take the same options as #iterator can
leveldown.getRange(opts, function (err, range) {
})

I find myself wanting to read a full range from time to time, so I end up reading everything from a stream and buffer it up, but with #96 in place perhaps that wouldn't need to be neccessary.

@rvagg
Copy link
Member

rvagg commented May 14, 2014

See also #13 & #9 (related)

As I've said there, I'm fine with this kind of thing. I don't think it'll be exposed through LevelUP but I'd like to get people used to using storage-layer specific functionality where it makes sense and where they're wedded to a specific storage-layer: db.db.getRande(). There's also lots of scope for addons that provide this kind of functionality to be feature-testing the LevelDOWN layer to see if it supports what they want and providing a polyfill if it doesn't!

@juliangruber
Copy link
Member

You could write level-get-range which checks for this.db.db.getRange and falls back to this.db.createReadStream

@kesla
Copy link
Contributor Author

kesla commented May 14, 2014

@juliangruber Great suggestion, that's how I'll implement it. Thanks for the suggestion!

@kesla kesla mentioned this issue May 14, 2014
@kesla
Copy link
Contributor Author

kesla commented May 15, 2014

@juliangruber
Copy link
Member

nice!

@ralphtheninja
Copy link
Member

Kesla is rocking! :)

@kesla kesla closed this as completed Oct 19, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Discussion
Projects
None yet
Development

No branches or pull requests

4 participants