Comments (11)
in the meantime i am using this workaround
function getLast(cb) {
db.iterator(function(err, iterator) {
if (err) return cb(err)
iterator.last(function(err) {
if (err) return cb(err)
iterator.current(function(err, key, val) {
cb(err, key)
})
})
})
}
then i can use the returned value as the end parameter in forRange
from node-leveldb.
I have further improved upon the above design here: max-mapper/plumbdb@0cf5212
essentially I am using the seek
, current
and next
functions on Iterator
wrapped in a readable Stream
from node-leveldb.
I am not opposed to this but do not have much time right now. If anyone wants to take a stab at it that would great.
from node-leveldb.
@maxogden Does the patch supplied resolve your issue? It seems like a different approach to a common problem.
from node-leveldb.
the above patch makes this library more usable but this issue should stay open as a stream would be a more ideal API
from node-leveldb.
So you mean write wrapper that iterates on your behalf and emits data events (ie a stream?). Iterating over key-values in leveldb is FAST. Imagine iterating over every key in a very large database, without back pressure I bet something would break. Run out of ram because there's too many events in the queue? Or perhaps the overhead from crossing the V8->C++ boundary would just grind your app to a screeching halt.
I can understand the desire for a stream interface, it sounds like it make more sense as helper module for people who understand that you shouldn't iterate over a large set with it. This module should match the leveldb C++ interface as much as possible IMHO.
from node-leveldb.
streams support backpressure. I get that it should match the c++ interface but it's a node binding and streams are part of node core
from node-leveldb.
@maxogden, I like your suggestion of exposing a stream. I may take a stab at this. Stay tuned.
from node-leveldb.
👍
from node-leveldb.
Fwiw I've been happy with the stream implementation in rvagg/levelup
Sent from my iPhone
On Mar 7, 2013, at 12:18 PM, Michael Phan-Ba [email protected] wrote:
—
Reply to this email directly or view it on GitHub.
from node-leveldb.
Wow, rvagg/levelup looks like it's really matured, and has a nice little ecosystem. Last I looked, there wasn't an "obvious" winner among the leveldb drivers. @maxogden, in your opinion, is there any reason to resurrect this node-leveldb project, or have you been satisfied with levelup? No need to reinvent the wheel.
from node-leveldb.
Related Issues (20)
- Switch to gitflow repository style HOT 6
- Collaborators wanted HOT 1
- npm install fails if coffee-script is already installed HOT 10
- demo/million.js is broken HOT 5
- share the same leveldb database between nodejs cluster processes HOT 3
- [request] Support synchronous open HOT 3
- makefile breaks during npm install HOT 3
- Release new version to NPM HOT 1
- Check when iterator.forEach finished HOT 1
- coffee-script needs to be installed? HOT 3
- doesn't work with node v0.8.1 HOT 8
- Random test failures HOT 4
- Fixes for 0.8 HOT 3
- Push to npm v0.8 compat version
- is snappy support really on? HOT 4
- random empty keys when iterating over a database HOT 5
- Fix build issues with node 0.10 HOT 9
- [0.10] Module can't be found? HOT 1
- Would you consider allowing the LevelUP team to take over "leveldb" in npm? HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from node-leveldb.