simulated-multitree

1.0.0 • Public • Published

Simulated MultiTree

I created this to work on some applications while Multitree finishes getting written. It probably won't be useful to most people.

npm i simulated-multitree
import { SimulatedMultitree, SimulatedOplog, SimulatedRemoteOplog } from 'simulated-multitree'

// Create an multitree with a single writer
const db = new SimulatedMultitree()
db.addWriter(new SimulatedOplog())

// Create another multitree with its own writer
const db2 = new SimulatedMultitree()
db2.addWriter(new SimulatedOplog())

// Add them as writers to each other
db.addWriter(new SimulatedRemoteOplog(db2.writers[0]))
db2.addWriter(new SimulatedRemoteOplog(db.writers[0]))

// "Connect" them
db.writers[1].connect()
db2.writers[1].connect()

// "Disconnect" them
db.writers[1].disconnect()
db2.writers[1].disconnect()

// the rest of the API works like BitTree except there's also a `conflicts` array value on gets

Dependents (0)

Package Sidebar

Install

npm i simulated-multitree

Weekly Downloads

1

Version

1.0.0

License

MIT

Unpacked Size

30.6 kB

Total Files

8

Last publish

Collaborators

  • neothawreww