-
Notifications
You must be signed in to change notification settings - Fork 3
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
LevelUP.createReadStream
returns an empty buffer.
#105
Comments
Okay. Wow. I've been testing directly against Locket which is implemented according to AbstractLevelDOWN. What you're telling me is that LevelUP is an interface, and Locket is an implementation and you specify an implementation to LevelUP as a parameter, so that it is composition. LevelUP is not the C bindings to LevelDB but an abstraction. All my testing is directly against Locket. That is, the tests that are not AbstractLevelDOWN tests. I need to update my tests to use the LevelUP API. Correct? |
I've made a change to one of my tests, testing through LevelUP. I'd really appreciate some feedback as to whether I'm on the right track to modeling actual API usage. |
@ogd: I take it you were able to...
? |
yes the locket tests passed for me. If you dont want to deal with levelup I can try to reproduce using only the iterator API (what createReadStream in levelup uses) |
@ogd: Just looking for clarity on the architecture. LevelUP is pure-JavaScript, I see. I thought it was the C bindings for LevelDB. If people are going to be using LevelUP to use Locket, then yes, I want my tests to reflect the user experience. |
this reproduces the bug using only locket: var locket = require('locket')
var db = new locket('./test-data')
db.open({ createIfMissing: true }, function() {
db.put('foo', 'bar', function(err) {
if (err) throw err
// these are a copy of what levelup passes to the
// leveldown iterator when it does createReadStream
var iteratorOptions = {
keys: true,
values: true,
createIfMissing: true,
errorIfExists: false,
keyEncoding: 'utf8',
valueEncoding: 'utf8',
compression: true,
limit: -1,
keyAsBuffer: false,
valueAsBuffer: false
}
var iterator = db.iterator(iteratorOptions)
iterator.next(function(key, val) {
console.log('iterator first hit:', key, val)
iterator.end(function() {
iterator.end(function() {
console.log('iterator ended')
})
})
})
})
}) I noticed that if you take |
Yes. A less than zero limit is going to be interpreted as zero, not unlimited. Will fix this. Thank you for the awesome test. |
@rvagg does this mean abstract-leveldown needs a test for negative limits? |
@maxogden probably! |
Need to step away from the computer for the evening. Fix is simple. Will fix in the morning. Thank you. |
Let me know if you're now able to proceed. |
another issue:
the above code should not return any results but I get:
|
@maxogden: It will be a while before I can do my Locket for the day. Can you use |
@maxogden: Thought I'd posted this. I didn't implement |
test case:
output is:
if you switch
locket
tomemdown
output is:The text was updated successfully, but these errors were encountered: