orbit-db-eventstore v2.0.0
orbit-db-eventstore
Append-Only Log database for orbit-db
An append-only log with traversable history. Useful for "latest N" use cases or as a message queue.
Used in orbit-db.
Table of Contents
Install
This project uses npm and nodejs
npm install orbit-db ipfsUsage
First, create an instance of OrbitDB:
import * as IPFS from 'ipfs'
import OrbitDB from 'orbit-db'
const ipfs = new IPFS()
const orbitdb = await OrbitDB.createInstance(ipfs)Get a log database and add an entry to it:
const log = await orbitdb.eventlog('haad.posts')
log.add({ name: 'hello world' })
.then(() => {
const items = log.iterator().collect().map(e => e.payload.value)
items.forEach(e => console.log(e.name))
// "hello world"
})Later, when the database contains data, load the history and query when ready:
const log = await orbitdb.eventlog('haad.posts')
log.events.on('ready', () => {
const items = log.iterator().collect().map(e => e.payload.value)
items.forEach(e => console.log(e.name))
// "hello world"
})See example/index.html for a detailed example. Note that to run this example, you need to have a local IPFS daemon running at port 5001.
API
See orbit-db's API Documenations for full details.
Contributing
If you think this could be better, please open an issue!
Please note that all interactions in @orbitdb fall under our Code of Conduct.
Note that tests for this module are in the orbit-db repository.
License
MIT © 2016-2020 Protocol Labs Inc., Haja Networks Oy
3 years ago
3 years ago
3 years ago
5 years ago
5 years ago
5 years ago
6 years ago
6 years ago
6 years ago
6 years ago
6 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
7 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
8 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago
10 years ago