Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function HyperDown (storage) {
if (!(this instanceof HyperDown)) return new HyperDown(storage)
this.status = Status.NEW
this.storage = storage
// Set in _open.
this._db = null
AbstractLevelDOWN.call(this, storage)
}
inherits(HyperDown, AbstractLevelDOWN)
function DB (db, opts) {
if (!(this instanceof DB)) return new DB(db, opts)
var manifest = db.supports || {}
var additionalMethods = manifest.additionalMethods || {}
AbstractLevelDOWN.call(this, manifest)
this.supports.encodings = true
this.supports.additionalMethods = {}
rangeMethods.forEach(function (m) {
// TODO (future major): remove this fallback
var fallback = typeof db[m] === 'function'
if (additionalMethods[m] || fallback) {
this.supports.additionalMethods[m] = true
this[m] = function (start, end, opts, cb) {
start = this.codec.encodeKey(start, opts)
end = this.codec.encodeKey(end, opts)
return this.db[m](start, end, opts, cb)
}
function RiakDOWN(location) {
if (!(this instanceof RiakDOWN)) return new RiakDOWN(location);
AbstractLevelDOWN.call(this, location);
var parsed = url.parse(location);
this._client = riakpbc.createClient({ host: parsed.hostname, port: parsed.port, parse_values: false });
this._bucket = parsed.path.split('/')[1];
}
function LevelDOWN (location) {
if (!(this instanceof LevelDOWN)) {
return new LevelDOWN(location)
}
if (typeof location !== 'string') {
throw new Error('constructor requires a location string argument')
}
AbstractLevelDOWN.call(this, {
bufferKeys: true,
snapshots: true,
permanence: true,
seek: true,
clear: true,
createIfMissing: true,
errorIfExists: true,
additionalMethods: {
approximateSize: true,
compactRange: true
}
})
this.location = location
this.context = binding.db_init()
}
function MysqlDOWN (location) {
AbstractLevelDOWN.call(this, location)
var parsed = url.parse(location)
, parsedPath = parsed.path.split('/').filter(Boolean)
, auth = parsed.auth
, user = null
, password = null
if (auth !== null && auth.indexOf(':') > 0) {
auth = auth.split(':')
user = auth[0]
password = auth[1] || ''
}
this.pool = mysql.createPool({
host: parsed.hostname
var MongoDOWN = module.exports = function (mongoUri) {
if (!(this instanceof MongoDOWN))
return new MongoDOWN(mongoUri);
AbstractLevelDOWN.call(this, mongoUri);
};
function FileDown(location) {
this.location = location;
AbstractLevelDOWN.call(this, location);
}
var settings = {
table: "azureleveldown",
partitionKey: "partition1"
}
if (!settingsOverride){
settingsOverride = {};
}
for (var key in settings){
settings[key] = settingsOverride[key] || settings[key];
}
this.config = settings;
AbstractLevelDOWN.call(this, typeof location == 'string' ? location : '')
}
function Locket (location) {
if (!(this instanceof Locket)) return new Locket(location)
AbstractLevelDOWN.call(this, location)
this._rotating = sequester.createLock()
this._append = sequester.createLock()
this._cursors = []
this._appending = []
this._primaryLeafSize = 1024
this._primaryBranchSize = 1024
this._stageLeafSize = 1024
this._stageBranchSize = 1024
this._reactor = new Reactor({ object: this, method: '_doubleCheck' })
this.merged = new Vestibule
}
util.inherits(Locket, AbstractLevelDOWN)
constructor (location) {
AbstractLevelDOWN.call(this, location)
}