Skip to content
This repository was archived by the owner on Dec 1, 2024. It is now read-only.

Commit 6178d69

Browse files
committed
merge
2 parents e3ab0eb + 89c1420 commit 6178d69

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+155
-170
lines changed

.travis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,4 @@ notifications:
2121
- pedro.teixeira@gmail.com
2222
- mail@substack.net
2323
script: npm run-script alltests
24+

LICENSE

Lines changed: 0 additions & 39 deletions
This file was deleted.

LICENSE.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
The MIT License (MIT)
2+
=====================
3+
4+
Copyright (c) 2014 LevelUP contributors
5+
---------------------------------------
6+
7+
*LevelUP contributors listed at <https://github.com/rvagg/node-levelup#contributors>*
8+
9+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10+
11+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12+
13+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -388,11 +388,13 @@ The standard `pause()`, `resume()` and `destroy()` methods are implemented on th
388388

389389
Additionally, you can supply an options object as the first parameter to `createReadStream()` with the following options:
390390

391-
* `'start'`: the key you wish to start the read at. By default it will start at the beginning of the store. Note that the *start* doesn't have to be an actual key that exists, LevelDB will simply find the *next* key, greater than the key you provide.
391+
* `'gt'` (greater than), `'gte'` (greater than or equal) define the lower bound of the range to be streamed. Only records where the key is greater than (or equal to) this option will be included in the range. When `reverse=true` the order will be reversed, but the records streamed will be the same.
392392

393-
* `'end'`: the key you wish to end the read on. By default it will continue until the end of the store. Again, the *end* doesn't have to be an actual key as an (inclusive) `<=`-type operation is performed to detect the end. You can also use the `destroy()` method instead of supplying an `'end'` parameter to achieve the same effect.
393+
* `'lt'` (less than), `'lte'` (less than or equal) define the higher bound of the range to be streamed. Only key/value pairs where the key is less than (or equal to) this option will be included in the range. When `reverse=true` the order will be reversed, but the records streamed will be the same.
394394

395-
* `'reverse'` *(boolean, default: `false`)*: a boolean, set to true if you want the stream to go in reverse order. Beware that due to the way LevelDB works, a reverse seek will be slower than a forward seek.
395+
* `'start', 'end'` legacy ranges - instead use `'gte', 'lte'`
396+
397+
* `'reverse'` *(boolean, default: `false`)*: a boolean, set true and the stream output will be reversed. Beware that due to the way LevelDB works, a reverse seek will be slower than a forward seek.
396398

397399
* `'keys'` *(boolean, default: `true`)*: whether the `'data'` event should contain keys. If set to `true` and `'values'` set to `false` then `'data'` events will simply be keys, rather than objects with a `'key'` property. Used internally by the `createKeyStream()` method.
398400

@@ -652,13 +654,11 @@ A custom encoding may be provided by passing in an object as an value for `keyEn
652654
{
653655
encode : function (val) { ... }
654656
, decode : function (val) { ... }
655-
, buffer : boolean // encode returns a buffer-like and decode accepts a buffer
657+
, buffer : boolean // encode returns a buffer and decode accepts a buffer
656658
, type : String // name of this encoding type.
657659
}
658660
```
659661

660-
*"buffer-like"* means either a `Buffer` if running in Node, or a Uint8Array if in a browser. Use [bops](https://github.com/chrisdickinson/bops) to get portable binary operations.
661-
662662
<a name="extending"></a>
663663
Extending LevelUP
664664
-----------------
@@ -720,13 +720,13 @@ LevelUP is only possible due to the excellent work of the following contributors
720720
A large portion of the Windows support comes from code by [Krzysztof Kowalczyk](http://blog.kowalczyk.info/) [@kjk](https://twitter.com/kjk), see his Windows LevelDB port [here](http://code.google.com/r/kkowalczyk-leveldb/). If you're using LevelUP on Windows, you should give him your thanks!
721721

722722

723-
<a name="licence"></a>
724-
Licence &amp; copyright
723+
<a name="license"></a>
724+
License &amp; copyright
725725
-------------------
726726

727-
Copyright (c) 2012-2013 LevelUP contributors (listed above).
727+
Copyright (c) 2012-2014 LevelUP contributors (listed above).
728728

729-
LevelUP is licensed under an MIT +no-false-attribs license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE file for more details.
729+
LevelUP is licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.
730730

731731
=======
732732
*LevelUP builds on the excellent work of the LevelDB and Snappy teams from Google and additional contributors. LevelDB and Snappy are both issued under the [New BSD Licence](http://opensource.org/licenses/BSD-3-Clause).*

lib/batch.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License
4-
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License
4+
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
55
*/
66

77
var util = require('./util')

lib/encodings.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,17 @@ module.exports = (function () {
3737
, buffer : false
3838
, type : 'json'
3939
}
40+
encodings.binary = {
41+
encode : function (data) {
42+
return isBinary(data) ? data : new Buffer(data)
43+
}
44+
, decode : function (data) {
45+
return data
46+
}
47+
, buffer : true
48+
, type : 'binary'
49+
}
50+
4051
encodingNames.forEach(function (type) {
4152
if (encodings[type])
4253
return
@@ -45,7 +56,7 @@ module.exports = (function () {
4556
return isBinary(data) ? data : new Buffer(data, type)
4657
}
4758
, decode : function (buffer) {
48-
return new Buffer(buffer, type)
59+
return buffer.toString(type)
4960
}
5061
, buffer : true
5162
, type : type // useful for debugging purposes

lib/errors.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License
4-
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License
4+
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
55
*/
66

77
var createError = require('errno').create
@@ -19,4 +19,4 @@ module.exports = {
1919
, WriteError : createError('WriteError', LevelUPError)
2020
, NotFoundError : NotFoundError
2121
, EncodingError : createError('EncodingError', LevelUPError)
22-
}
22+
}

lib/levelup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License
4-
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License
4+
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
55
*/
66

77
var EventEmitter = require('events').EventEmitter

lib/read-stream.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
// NOTE: we are fixed to readable-stream@1.0.x for now

lib/util.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License
4-
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License
4+
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
55
*/
66

77
var extend = require('xtend')
@@ -16,7 +16,6 @@ var extend = require('xtend')
1616
}
1717

1818
, leveldown
19-
2019
, encodingOpts = (function () {
2120
var eo = {}
2221
for(var e in encodings)

lib/write-stream.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License
4-
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License
4+
* <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
55
*/
66

77
var Stream = require('stream').Stream
88
, inherits = require('util').inherits
99
, extend = require('xtend')
10-
, concatStream = require('concat-stream')
10+
, bl = require('bl')
1111

1212
, setImmediate = global.setImmediate || process.nextTick
1313

@@ -157,7 +157,7 @@ WriteStream.prototype._write = function (entry) {
157157
if (!key)
158158
return
159159

160-
entry.pipe(concatStream(function (err, data) {
160+
entry.pipe(bl(function (err, data) {
161161
if (err) {
162162
self.writable = false
163163
return self.emit('error', err)
@@ -167,7 +167,7 @@ WriteStream.prototype._write = function (entry) {
167167
key.indexOf(self._options.fstreamRoot) > -1)
168168
key = key.substr(self._options.fstreamRoot.length + 1)
169169

170-
self.write({ key: key, value: data })
170+
self.write({ key: key, value: data.slice(0) })
171171
}))
172172
}
173173

package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "levelup",
33
"description": "Fast & simple storage - a Node.js-style LevelDB wrapper",
4-
"version": "0.18.3",
4+
"version": "0.18.6",
55
"contributors": [
66
"Rod Vagg <r@va.gg> (https://github.com/rvagg)",
77
"John Chesley <john@chesl.es> (https://github.com/chesles/)",
@@ -33,13 +33,13 @@
3333
],
3434
"main": "lib/levelup.js",
3535
"dependencies": {
36-
"concat-stream": "~0.1.1",
36+
"bl": "~0.8.1",
3737
"deferred-leveldown": "~0.2.0",
38-
"errno": "~0.1.0",
38+
"errno": "~0.1.1",
3939
"prr": "~0.0.0",
40-
"readable-stream": "~1.0.17",
41-
"semver": "~2.2.1",
42-
"xtend": "~2.1.1"
40+
"readable-stream": "~1.0.26",
41+
"semver": "~2.3.1",
42+
"xtend": "~3.0.0"
4343
},
4444
"devDependencies": {
4545
"leveldown": "~0.10.0",

test/approximate-size-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
var levelup = require('../lib/levelup.js')
@@ -77,4 +77,4 @@ buster.testCase('approximateSize()', {
7777
, done
7878
)
7979
}
80-
})
80+
})

test/argument-checking-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
var common = require('./common')

test/batch-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
var errors = require('../lib/errors.js')
@@ -369,4 +369,4 @@ buster.testCase('batch()', {
369369
}
370370
}
371371
}
372-
})
372+
})

test/benchmarks/engines/index.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
module.exports.LevelUP = require('./levelup')
@@ -16,4 +16,4 @@ module.exports.Leveled = require('./leveled')
1616
module.exports.Leveled.color = 'cyan'
1717

1818
module.exports.SQLite3 = require('./sqlite3')
19-
module.exports.SQLite3.color = 'blue'
19+
module.exports.SQLite3.color = 'blue'

test/benchmarks/engines/leveled.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
var leveled = require('leveled')
@@ -18,4 +18,4 @@ var leveled = require('leveled')
1818
module.exports = {
1919
createDb : createDb
2020
, closeDb : closeDb
21-
}
21+
}

test/benchmarks/engines/levelup-nosnappy.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
var levelup = require('../../../')
@@ -18,4 +18,4 @@ var levelup = require('../../../')
1818
module.exports = {
1919
createDb : createDb
2020
, closeDb : closeDb
21-
}
21+
}

test/benchmarks/engines/levelup-release.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
var levelup = require('levelup')
@@ -18,4 +18,4 @@ var levelup = require('levelup')
1818
module.exports = {
1919
createDb : createDb
2020
, closeDb : closeDb
21-
}
21+
}

test/benchmarks/engines/levelup.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
/* Copyright (c) 2012-2013 LevelUP contributors
1+
/* Copyright (c) 2012-2014 LevelUP contributors
22
* See list at <https://github.com/rvagg/node-levelup#contributing>
3-
* MIT +no-false-attribs License <https://github.com/rvagg/node-levelup/blob/master/LICENSE>
3+
* MIT License <https://github.com/rvagg/node-levelup/blob/master/LICENSE.md>
44
*/
55

66
var levelup = require('../../../')
@@ -18,4 +18,4 @@ var levelup = require('../../../')
1818
module.exports = {
1919
createDb : createDb
2020
, closeDb : closeDb
21-
}
21+
}

0 commit comments

Comments
 (0)