InterDB
InterDB is a shared database with auto discovery.
Example
const interdb = require('interdb')
const con = new interdb()
con.startLocal('./path.local.db')
con.start({
namespace: 'business',
password: 'long-password',
path: './path.db',
localPath: './path.local.db',
identity : {
}
})
con.stop()
con.clients.*
con.localDb.put('key', 'value', cb)
con.localDb.push('key', 'value', cb)
con.localDb.del('key', cb)
con.localDb.get('key')
con.localDb.updateAll({ data: {} }, cb)
con.localDb.getLastUpdate()
con.localDb.save(cb)
con.db.put('key', 'value', cb)
con.db.push('key', 'value', cb)
con.db.del('key', cb)
con.db.get('key')
con.db.updateAll({ data: {} }, cb)
con.db.getLastUpdate()
con.db.save(cb)
Database structure
{
lastUpdate: "",
data: {}
}
Communication structure
Normal
Host A <-> Host B <-> Host C
^----------------------^
Problem
Host A <-> Host B <-> Host C