How to use the abstract-leveldown.AbstractLevelDOWN.call function in abstract-leveldown

To help you get started, we’ve selected a few abstract-leveldown examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github andrewosh / hyperdown / index.js View on Github external
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)
github Level / encoding-down / index.js View on Github external
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)
      }
github nlf / riakdown / index.js View on Github external
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];
}
github Level / leveldown / leveldown.js View on Github external
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()
}
github kesla / mysqlDOWN / mysqldown.js View on Github external
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
github watson / mongodown / index.js View on Github external
var MongoDOWN = module.exports = function (mongoUri) {
  if (!(this instanceof MongoDOWN))
    return new MongoDOWN(mongoUri);
  AbstractLevelDOWN.call(this, mongoUri);
};
github trufflesuite / ganache-core / lib / database / filedown.js View on Github external
function FileDown(location) {
  this.location = location;
  AbstractLevelDOWN.call(this, location);
}
github richorama / azureleveldown / index.js View on Github external
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 : '')
}
github bigeasy / locket / locket.js View on Github external
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)
github mhsjlw / node-leveldb-mcpe / index.js View on Github external
constructor (location) {
    AbstractLevelDOWN.call(this, location)
  }