This repository was archived by the owner on Dec 2, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Upgrade to latest Level modules (#15)
* Upgrade to latest Level modules * Add subleveldown test * Add encrypt-down test
- Loading branch information
Showing
13 changed files
with
471 additions
and
91 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
language: node_js | ||
node_js: | ||
- '0.10' | ||
- '0.12' | ||
- '4.0' | ||
- '5.0' | ||
- 8 | ||
- 10 | ||
- 12 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,32 @@ | ||
var levelup = require('levelup') | ||
var duplexify = require('duplexify') | ||
var encode = require('encoding-down') | ||
var leveldown = require('./leveldown') | ||
|
||
module.exports = function (opts) { | ||
if (!opts) opts = {} | ||
|
||
var down | ||
opts.db = createLeveldown | ||
opts.onflush = onflush | ||
var db = levelup('multileveldown', opts) | ||
var down = leveldown(Object.assign({}, opts, { onflush: onflush })) | ||
var db = levelup(encode(down, opts), opts) | ||
|
||
db.createRpcStream = db.connect = connect | ||
db.isFlushed = isFlushed | ||
db.forward = forward | ||
|
||
return db | ||
|
||
function createLeveldown (path) { | ||
down = leveldown(path, opts) | ||
return down | ||
} | ||
|
||
function onflush () { | ||
db.emit('flush') | ||
} | ||
|
||
function connect (opts) { | ||
if (down) return down.createRpcStream(opts, null) | ||
return down.createRpcStream(opts, null) | ||
} | ||
|
||
var proxy = duplexify() | ||
db.open(function () { | ||
down.createRpcStream(opts, proxy) | ||
}) | ||
function isFlushed () { | ||
return down.isFlushed() | ||
} | ||
|
||
return proxy | ||
function forward (db) { | ||
down.forward(db) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
module.exports = function matchdown (db, type) { | ||
// Skip layers that we handle ourselves | ||
if (type === 'levelup') return false | ||
if (type === 'encoding-down') return false | ||
if (type === 'deferred-leveldown') return false | ||
|
||
return true | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
var pbs = require('pbs') | ||
var fs = require('fs') | ||
var path = require('path') | ||
|
||
module.exports = pbs(fs.readFileSync(__dirname + '/schema.proto')) | ||
module.exports = pbs(fs.readFileSync(path.join(__dirname, 'schema.proto'))) |
Oops, something went wrong.