Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
triggers for levelup
JavaScript
Branch: master

Merge pull request #9 from Neppord/master

Remove stability warning.
latest commit 16ffc13265
@dominictarr authored
Failed to load latest commit information.
test work-around in test :(
.gitignore initial
.travis.yml initial
LICENSE initial
README.md Remove stability warning.
index.js [fix] wrap the retry in a setTimeout
package.json Remove stability warning.

README.md

level-trigger

Triggers for levelup.

Jobs must be idempotent! If the process crashes before job has calledback, it will be rerun the next time it's started, for consistency!

Stability

Stable: Expect bugfixes.

Example

var db       = require('levelup')('/tmp/level-trigger-example')
var SubLevel = require('level-sublevel'); SubLevel(db) //MUST install sublevel.
var Trigger  = require('level-trigger')

var trigDb = Trigger(db, 'example', function (ch) {
    //optionally index the job with a different key.
    //if there are two jobs with the same key,
    //it will only be triggered once.
    return ch.key
  },
  function (value, done) { 
    //call done when job is done.
    done()
  }
})

//if you want, start the trigger in batch mode.
//this will process all the keys in the input db.

//otherwise, jobs will be processed whenever a key is inserted!

if(require('optimist').argv.batch)
  trigDb.start()

License

MIT

Something went wrong with that request. Please try again.