Skip to content

Commit

Permalink
solved conflict and updated leveldown-prebuilt to leveldown
Browse files Browse the repository at this point in the history
  • Loading branch information
ralphtheninja committed May 30, 2015
2 parents 541a065 + d513066 commit 79412de
Show file tree
Hide file tree
Showing 47 changed files with 383 additions and 306 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ bench/
*.obj
*.1sdk.pdb
*.lastbuildstate
npm-debug.log
18 changes: 9 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
language: node_js

before_install:
- export JOBS=max

node_js:
- "2.0.0"
- "1.8.1"
- "0.12"
- "0.10"
branches:
only:
- master
notifications:
email:
- [email protected]
script: npm test

before_install:
- npm install -g npm@latest
script:
- npm test

42 changes: 42 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,45 @@
Note that we have filtered out commits related to new tags, updating changelog and we're also not listing any merge commits, i.e. we are only listing things that changed between versions.

### 1.0.7 May 27 2015

* [[`61398a0056`](https://github.com/level/leveldown/commit/61398a0056)] - link to level/community (Lars-Magnus Skog)
* [[`382a1a7fa3`](https://github.com/level/leveldown/commit/382a1a7fa3)] - add compression test suite (Julian Gruber)
* [[`139db7bc7f`](https://github.com/level/leveldown/commit/139db7bc7f)] - use const reference instead of by value in Database constructor (Lars-Magnus Skog)
* [[`b56a86323e`](https://github.com/level/leveldown/commit/b56a86323e)] - refactor NanNew() on strings into option value functions (Lars-Magnus Skog)
* [[`ca1f4746c4`](https://github.com/level/leveldown/commit/ca1f4746c4)] - refactor BooleanOptionValue (Lars-Magnus Skog)
* [[`56def2d7c8`](https://github.com/level/leveldown/commit/56def2d7c8)] - NanUInt32OptionValue -> UInt32OptionValue (Lars-Magnus Skog)
* [[`39c614a24f`](https://github.com/level/leveldown/commit/39c614a24f)] - NanBooleanOptionValue -> BooleanOptionValue (Lars-Magnus Skog)
* [[`fcdc46183e`](https://github.com/level/leveldown/commit/fcdc46183e)] - simplify location logic, let Database take care of allocation (Lars-Magnus Skog)
* [[`8cb90e6b6d`](https://github.com/level/leveldown/commit/8cb90e6b6d)] - update abstract-leveldown (Lars-Magnus Skog)
* [[`f70b6576e7`](https://github.com/level/leveldown/commit/f70b6576e7)] - update .travis.yml (nvm works on travis now) (Lars-Magnus Skog)
* [[`007550e7f7`](https://github.com/level/leveldown/commit/007550e7f7)] - 1.0.6 (Lars-Magnus Skog)

### 1.0.5/1.0.6 May 5 2015

* [[`9064099fe7`](https://github.com/level/leveldown/commit/9064099fe7)] - pass db to abstractIterator so gc keeps it (Julian Gruber)

### 1.0.4 May 5 2015

* [[`b550c98291`](https://github.com/level/leveldown/commit/b550c98291)] - update nan for iojs 2.0.0 (Lars-Magnus Skog)

### 1.0.3 May 2 2015

* [[`82479b689f`](https://github.com/level/leveldown/commit/82479b689f)] - tap -> tape + faucet (Lars-Magnus Skog)
* [[`ca9101542a`](https://github.com/level/leveldown/commit/ca9101542a)] - fix write-random.js, use leveldown instead of lmdb (Lars-Magnus Skog)
* [[`03fbbfb99f`](https://github.com/level/leveldown/commit/03fbbfb99f)] - fix bench/db-bench.js (Lars-Magnus Skog)

### 1.0.2 Apr 26 2015
* [[`8470a63678`](https://github.com/level/leveldown/commit/8470a63678)] - s/rvagg\/node-/level\// (Lars-Magnus Skog)
* [[`9cbf592bea`](https://github.com/level/leveldown/commit/9cbf592bea)] - add documentation about snapshots (Max Ogden)
* [[`b57827cd29`](https://github.com/level/leveldown/commit/b57827cd29)] - use n instead of nvm for working iojs support (Lars-Magnus Skog)
* [[`a19927667a`](https://github.com/level/leveldown/commit/a19927667a)] - abstract-leveldown ~2.1.0 (ralphtheninja)
* [[`95ccdf0850`](https://github.com/level/leveldown/commit/95ccdf0850)] - update logo and copyright (Lars-Magnus Skog)
* [[`09e89d7abb`](https://github.com/level/leveldown/commit/09e89d7abb)] - updated my email (ralphtheninja)

### 1.0.1 Jan 16 2015
* [[`6df3ecd6f5`](https://github.com/level/leveldown/commit/6df3ecd6f5)] - nan 1.5 for io.js support (Rod Vagg)
* [[`5198231a88`](https://github.com/level/leveldown/commit/5198231a88)] - Fix LevelDB builds for modern gcc versions (Sharvil Nanavati)

### 1.0.0 Aug 26 2014
* [email protected] for Node 0.11.13+ support (@rvagg)
* Allow writing empty values: null, undefined, '', [] and Buffer(0). Entries come out as '' or Buffer(0) (@ggreer, @juliangruber, @rvagg)
Expand Down
27 changes: 0 additions & 27 deletions CONTRIBUTING.md

This file was deleted.

40 changes: 13 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@ LevelDOWN
A Low-level Node.js LevelDB binding
-------------------------

[![Build Status](https://secure.travis-ci.org/rvagg/node-leveldown.png)](http://travis-ci.org/rvagg/node-leveldown)
[![Build Status](https://secure.travis-ci.org/Level/leveldown.png)](http://travis-ci.org/Level/leveldown)

[![NPM](https://nodei.co/npm/leveldown.png?stars&downloads&downloadRank)](https://nodei.co/npm/leveldown/) [![NPM](https://nodei.co/npm-dl/leveldown.png?months=6&height=3)](https://nodei.co/npm/leveldown/)

LevelDOWN was extracted from [LevelUP](https://github.com/rvagg/node-levelup) and now serves as a stand-alone binding for LevelDB.
LevelDOWN was extracted from [LevelUP](https://github.com/level/levelup) and now serves as a stand-alone binding for LevelDB.

It is **strongly recommended** that you use LevelUP in preference to LevelDOWN unless you have measurable performance reasons to do so. LevelUP is optimised for usability and safety. Although we are working to improve the safety of the LevelDOWN interface it is still easy to crash your Node process if you don't do things in just the right way.

Expand All @@ -42,7 +42,7 @@ Tested & supported platforms
* **Solaris** (SmartOS & Nodejitsu)
* **FreeBSD**
* **Windows**
* Node 0.10 and above only, see [issue #5](https://github.com/rvagg/node-levelup/issues/5) for more info
* Node 0.10 and above only, see [issue #5](https://github.com/level/levelup/issues/5) for more info
* See installation instructions for *node-gyp* dependencies [here](https://github.com/TooTallNate/node-gyp#installation), you'll need these (free) components from Microsoft to compile and run any native Node add-on in Windows.

<a name="api"></a>
Expand Down Expand Up @@ -165,7 +165,7 @@ The `callback` function will be called with no arguments if the operation is suc
### leveldown#batch(operations[, options], callback)
<code>batch()</code> is an instance method on an existing database object. Used for very fast bulk-write operations (both *put* and *delete*). The `operations` argument should be an `Array` containing a list of operations to be executed sequentially, although as a whole they are performed as an atomic operation inside LevelDB. Each operation is contained in an object having the following properties: `type`, `key`, `value`, where the *type* is either `'put'` or `'del'`. In the case of `'del'` the `'value'` property is ignored. Any entries with a `'key'` of `null` or `undefined` will cause an error to be returned on the `callback`. Any entries where the *type* is `'put'` that have a `'value'` of `undefined`, `null`, `[]`, `''` or `new Buffer(0)` will be stored as a zero-length character array and therefore be fetched during reads as either `''` or `new Buffer(0)` depending on how they are requested.

See [LevelUP](https://github.com/rvagg/node-levelup#batch) for full documentation on how this works in practice.
See [LevelUP](https://github.com/level/levelup#batch) for full documentation on how this works in practice.

#### `options`

Expand Down Expand Up @@ -282,6 +282,12 @@ Currently LevelDOWN does not track the state of the underlying LevelDB instance.

LevelUP currently tracks and manages state and will prevent out-of-state operations from being send to LevelDOWN. If you use LevelDOWN directly then you must track and manage state for yourself.

<a name="snapshots"></a>
Snapshots
---------------

LevelDOWN exposes a feature of LevelDB called [snapshots](http://leveldb.googlecode.com/git-history/f779e7a5d89f853fc5224f9eb8103ca2b8f2f555/doc/index.html). This means that when you do e.g. `createReadStream` and `createWriteStream` at the same time, any data modified by the write stream will not affect data emitted from the read stream. In other words, a LevelDB Snapshot captures the latest state at the time the snapshot was created, enabling the snapshot to iterate or read the data without seeing any subsequent writes. Any read not performed on a snapshot will implicitly use the latest state.

<a name="support"></a>
Getting support
---------------
Expand All @@ -300,27 +306,7 @@ LevelDOWN is an **OPEN Open Source Project**. This means that:

> Individuals making significant and valuable contributions are given commit-access to the project to contribute as they see fit. This project is more like an open wiki than a standard guarded open source project.
See the [CONTRIBUTING.md](https://github.com/rvagg/node-leveldown/blob/master/CONTRIBUTING.md) file for more details.

### Contributors

LevelDOWN is only possible due to the excellent work of the following contributors:

<table><tbody>
<tr><th align="left">Rod Vagg</th><td><a href="https://github.com/rvagg">GitHub/rvagg</a></td><td><a href="http://twitter.com/rvagg">Twitter/@rvagg</a></td></tr>
<tr><th align="left">John Chesley</th><td><a href="https://github.com/chesles/">GitHub/chesles</a></td><td><a href="http://twitter.com/chesles">Twitter/@chesles</a></td></tr>
<tr><th align="left">Jake Verbaten</th><td><a href="https://github.com/raynos">GitHub/raynos</a></td><td><a href="http://twitter.com/raynos2">Twitter/@raynos2</a></td></tr>
<tr><th align="left">Dominic Tarr</th><td><a href="https://github.com/dominictarr">GitHub/dominictarr</a></td><td><a href="http://twitter.com/dominictarr">Twitter/@dominictarr</a></td></tr>
<tr><th align="left">Max Ogden</th><td><a href="https://github.com/maxogden">GitHub/maxogden</a></td><td><a href="http://twitter.com/maxogden">Twitter/@maxogden</a></td></tr>
<tr><th align="left">Lars-Magnus Skog</th><td><a href="https://github.com/ralphtheninja">GitHub/ralphtheninja</a></td><td><a href="http://twitter.com/ralphtheninja">Twitter/@ralphtheninja</a></td></tr>
<tr><th align="left">David Björklund</th><td><a href="https://github.com/kesla">GitHub/kesla</a></td><td><a href="http://twitter.com/david_bjorklund">Twitter/@david_bjorklund</a></td></tr>
<tr><th align="left">Julian Gruber</th><td><a href="https://github.com/juliangruber">GitHub/juliangruber</a></td><td><a href="http://twitter.com/juliangruber">Twitter/@juliangruber</a></td></tr>
<tr><th align="left">Paolo Fragomeni</th><td><a href="https://github.com/hij1nx">GitHub/hij1nx</a></td><td><a href="http://twitter.com/hij1nx">Twitter/@hij1nx</a></td></tr>
<tr><th align="left">Anton Whalley</th><td><a href="https://github.com/No9">GitHub/No9</a></td><td><a href="https://twitter.com/antonwhalley">Twitter/@antonwhalley</a></td></tr>
<tr><th align="left">Matteo Collina</th><td><a href="https://github.com/mcollina">GitHub/mcollina</a></td><td><a href="https://twitter.com/matteocollina">Twitter/@matteocollina</a></td></tr>
<tr><th align="left">Pedro Teixeira</th><td><a href="https://github.com/pgte">GitHub/pgte</a></td><td><a href="https://twitter.com/pgte">Twitter/@pgte</a></td></tr>
<tr><th align="left">James Halliday</th><td><a href="https://github.com/substack">GitHub/substack</a></td><td><a href="https://twitter.com/substack">Twitter/@substack</a></td></tr>
</tbody></table>
See the [contribution guide](https://github.com/Level/community/blob/master/CONTRIBUTING.md) for more details.

### Windows

Expand All @@ -331,8 +317,8 @@ A large portion of the Windows support comes from code by [Krzysztof Kowalczyk](
License &amp; copyright
-------------------

Copyright (c) 2012-2015 LevelDOWN contributors (listed above).
Copyright &copy; 2012-2015 **LevelDOWN** [contributors](https://github.com/level/community#contributors).

LevelDOWN 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.
**LevelDOWN** 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.

*LevelDOWN 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).*
62 changes: 30 additions & 32 deletions bench/db-bench.js
Original file line number Diff line number Diff line change
@@ -1,58 +1,44 @@
#!/usr/bin/env node

const leveldown = require('../')
, fs = require('fs')
, du = require('du')
, rimraf = require('rimraf')
const leveldown = require('../')
, fs = require('fs')
, du = require('du')
, rimraf = require('rimraf')

, argv = require('optimist').argv
, argv = require('optimist').argv

, options = {
, options = {
benchmark : argv.benchmark
, useExisting : argv.use_existing
, db : argv.db
, db : argv.db || __dirname + '/db'
, num : argv.num || 1000000
, concurrency : argv.concurrency || 4
, cacheSize : argv.cacheSize || 8
, writeBufferSize : argv.writeBufferSize || 4
, valueSize : argv.valueSize || 100
, timingOutput : argv.timingOutput
, timingOutput : argv.timingOutput || __dirname + '/timingOutput'
, throughputOutput : argv.throughputOutput
}

, randomData = require('./random-data')()
, keyTmpl = '0000000000000000'
, randomString = require('slump').string
, keyTmpl = '0000000000000000'

if (!options.useExisting) {
leveldown.destroy(options.db, function () {})
}

var db = leveldown(options.db)
, timesStream = options.timingOutput
&& fs.createWriteStream(options.timingOutput, 'utf8')
// , throughputStream = options.throughputOutput
// && fs.createWriteStream(options.throughputOutput, 'utf8')
, timesStream = fs.createWriteStream(options.timingOutput, 'utf8')

// make a 16 char padded key
function makeKey () {
function make16CharPaddedKey () {
var r = Math.floor(Math.random() * options.num)
, k = keyTmpl + r
return k.substr(k.length - 16)
}

timesStream.write('Elapsed (ms), Entries, Bytes, Last 1000 Avg Time, MB/s\n')

setTimeout(function () {
db.open({
errorIfExists : false
, createIfMissing : true
, cacheSize : options.cacheSize << 20
, writeBufferSize : options.writeBufferSize << 20
}, function (err) {

if (err)
throw err

function start () {
var inProgress = 0
, totalWrites = 0
, totalBytes = 0
Expand Down Expand Up @@ -103,24 +89,36 @@ setTimeout(function () {
+ ',' + (Math.floor(((totalBytes / 1048576) / (elapsed / 1000)) * 100) / 100)
+ '\n')
timesAccum = 0
//timesStream.write(writeBuf)
//writeBuf = ''
}

var time = process.hrtime()

db.put(makeKey(), randomData.generate(options.valueSize), function (err) {
db.put(make16CharPaddedKey(), randomString({ length: options.valueSize }), function (err) {
if (err)
throw err

totalBytes += keyTmpl.length + options.valueSize
timesAccum += process.hrtime(time)[1]
//writeBuf += (Date.now() - startTime) + ',' + process.hrtime(time)[1] + '\n'
inProgress--
process.nextTick(write)
})
}

for (var i = 0; i < options.concurrency; i++)
write()
})}, 500)
}

setTimeout(function () {
db.open({
errorIfExists : false
, createIfMissing : true
, cacheSize : options.cacheSize << 20
, writeBufferSize : options.writeBufferSize << 20
}, function (err) {
if (err)
throw err

start()

})
}, 500)
6 changes: 1 addition & 5 deletions bench/write-random.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const leveldown = require('../../lmdb/')
const leveldown = require('../')
, crypto = require('crypto')
, fs = require('fs')
, du = require('du')
Expand Down Expand Up @@ -31,15 +31,12 @@ db.open(function (err) {
var inProgress = 0
, totalWrites = 0
, startTime = Date.now()
//, timesTotal = 0
, writeBuf = ''

function write() {
if (totalWrites % 100000 == 0) console.log(inProgress, totalWrites)

if (totalWrites % 1000 == 0) {
//timesStream.write((Date.now() - startTime) + ',' + Math.floor(timesTotal / 1000) + '\n')
//timesTotal = 0
timesStream.write(writeBuf)
writeBuf = ''
}
Expand All @@ -56,7 +53,6 @@ db.open(function (err) {
db.put(uuid.v4(), data, function (err) {
if (err)
throw err
//timesTotal += process.hrtime(time)[1]
writeBuf += (Date.now() - startTime) + ',' + process.hrtime(time)[1] + '\n'
inProgress--
process.nextTick(write)
Expand Down
6 changes: 1 addition & 5 deletions bench/write-sorted.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,12 @@ db.open({ errorIfExists: true, createIfMissing: true }, function (err) {
var inProgress = 0
, totalWrites = 0
, startTime = Date.now()
//, timesTotal = 0
, writeBuf = ''

function write() {
if (totalWrites % 100000 == 0) console.log(inProgress, totalWrites)

if (totalWrites % 1000 == 0) {
//timesStream.write((Date.now() - startTime) + ',' + Math.floor(timesTotal / 1000) + '\n')
//timesTotal = 0
timesStream.write(writeBuf)
writeBuf = ''
}
Expand All @@ -56,7 +53,6 @@ db.open({ errorIfExists: true, createIfMissing: true }, function (err) {
db.put(timestamp(), data, function (err) {
if (err)
throw err
//timesTotal += process.hrtime(time)[1]
writeBuf += (Date.now() - startTime) + ',' + process.hrtime(time)[1] + '\n'
inProgress--
process.nextTick(write)
Expand All @@ -66,4 +62,4 @@ db.open({ errorIfExists: true, createIfMissing: true }, function (err) {
}

write()
})
})
4 changes: 2 additions & 2 deletions iterator.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const util = require('util')


function Iterator (db, options) {
AbstractIterator.call(this, options)
AbstractIterator.call(this, db)

this.binding = db.binding.iterator(options)
this.cache = null
Expand Down Expand Up @@ -51,4 +51,4 @@ Iterator.prototype._end = function (callback) {
}


module.exports = Iterator
module.exports = Iterator
Loading

0 comments on commit 79412de

Please sign in to comment.