level-shared-batch

1.0.0 • Public • Published

level-shared-batch

Share batches and commit collectively.

Example

var db = level('db')

// Create a shared batch object

var fork = shared(db.batch())

// Those two modules will now add their operations to a fork of the original
// batch, and batch.write(...) will mark their work as done. Once both
// modules called batch.write(), all the operations will be executed in one
// atomic go.

moduleA.doSomething({ batch: fork() })

moduleB.doAnotherThing({ batch: fork() })

Installation

$ npm install level-shared-batch

API

fork = shared(batch)

Create a new fork for batch.

fork#put(key, value)

fork#del(key)

fork#clear()

fork#write(cb)

License

MIT

Readme

Keywords

none

Package Sidebar

Install

npm i level-shared-batch

Weekly Downloads

1

Version

1.0.0

License

MIT

Last publish

Collaborators

  • juliangruber