How to use the level.destroy function in level

To help you get started, we’ve selected a few level 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 albertdb / Raft / server.js View on Github external
db.close(function(err){
            if(err) throw err;
            console.log('Destroying current DB.');
            levelup.destroy('./'+id+'.db',function(err){
                if(err) throw err;
                console.log('Creating new DB.');
                db=levelup('./'+id+'.db');
                db.batch(data, function (err) {
                    console.log('Installing data...');
                      if(err) throw err;
                      installSnapshot.pendingBatches--;
                      if(done){
                          var message=JSON.stringify({rpc: 'replyAppendEntries', term: currentTerm, followerId: id, entriesToAppend: 0, success: true});
                          log=newLog();
                          log.shift();
                          log.firstIndex=lastIncludedIndex+1;
                          log.length=log.firstIndex;
                          commitIndex=lastIncludedIndex;
                          lastApplied=lastIncludedIndex;
                          recoveryMode=false;
github dominictarr / streamview / links.js View on Github external
db.get('~meta~', function (err, value) {
        if(value)
          try { value = JSON.parse(value) }
          catch (err) { return cb(null, 0) }

        if(err) //first time this was run
          cb(null, 0)
          
        //if the view has changed, rebuild entire index.
        //else, read current version.
        else if(version && value.version !== version)
          level.destroy(path, function (err) {
            if(err) return cb(err)
            db = level(path)
            cb(null, 0)
          })
        else
          cb(null, value.since || 0)
      })
    },
github dirigeants / komada-pieces / providers / levelup.js View on Github external
  .then(exists => (exists ? level.destroy(baseDir + sep + table).then(() => fs.remove(baseDir + sep + table)) : null));
github proofofexistence / proofofexistence / lib / db.js View on Github external
function destroy () {
  db.close()
  level.destroy(path)
}
github ssbc / ssb-db / follower.js View on Github external
close(function () {
        Level.destroy(path, function (err) {
          if(err) throw err //just die?
          db = create(path)
          since = 0
          next()
        })
      })
    }