Comparing version 0.11.1 to 0.11.2
@@ -30,4 +30,5 @@ var crypto = require('crypto'), | ||
var db = sublevel(levelup(options.path)), | ||
tableDb = db.sublevel('table', {valueEncoding: 'json'}), | ||
var db = levelup(options.path), | ||
sublevelDb = sublevel(db), | ||
tableDb = sublevelDb.sublevel('table', {valueEncoding: 'json'}), | ||
itemDbs = [] | ||
@@ -39,3 +40,3 @@ | ||
if (!itemDbs[name]) { | ||
itemDbs[name] = db.sublevel('item-' + name, {valueEncoding: 'json'}) | ||
itemDbs[name] = sublevelDb.sublevel('item-' + name, {valueEncoding: 'json'}) | ||
itemDbs[name].lock = new Lock() | ||
@@ -82,2 +83,3 @@ } | ||
updateTableMs: options.updateTableMs, | ||
db: db, | ||
tableDb: tableDb, | ||
@@ -84,0 +86,0 @@ getItemDb: getItemDb, |
17
index.js
@@ -22,3 +22,3 @@ var http = require('http'), | ||
options = options || {} | ||
var requestHandler = httpHandler.bind(null, db.create(options)) | ||
var server, store = db.create(options), requestHandler = httpHandler.bind(null, store) | ||
@@ -29,6 +29,17 @@ if (options.ssl) { | ||
options.ca = options.ca || fs.readFileSync(__dirname + '/ca.pem') | ||
return https.createServer(options, requestHandler) | ||
server = https.createServer(options, requestHandler) | ||
} else { | ||
server = http.createServer(requestHandler) | ||
} | ||
return http.createServer(requestHandler) | ||
// Ensure we close DB when we're closing the server too | ||
var httpServerClose = server.close | ||
server.close = function(cb) { | ||
store.db.close(function(err) { | ||
if (err) return cb(err) | ||
httpServerClose.call(server, cb) | ||
}) | ||
} | ||
return server | ||
} | ||
@@ -35,0 +46,0 @@ |
{ | ||
"name": "dynalite", | ||
"version": "0.11.1", | ||
"version": "0.11.2", | ||
"description": "An implementation of Amazon's DynamoDB built on LevelDB", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
133020
3087