orbit-db-counterstore v2.0.0
orbit-db-counterstore
Counters database for OrbitDB
A simple counters database. Useful for example counting events separate from data.
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 = OrbitDB.createInstance(ipfs)Get a log database and add an entry to it:
const counter = await orbitdb.counter('visitors')
await counter.inc()
console.log(counter.value)
// 1
await counter.inc(4)
console.log(counter.value)
// 5Later, when the database contains data, load the history and query when ready:
const counter = await orbitdb.counter('visitors')
counter.events.on('ready', () => {
await counter.inc()
console.log(counter.value)
// 6
})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 OrbitDB's API Documentation for full details.
Contribute
Please, feel free to contribute! Take a look at the issues, and comment on an existing issue or create a new one if you have questions, bugs, or suggestions. For larger PRs, open an issue first if you could - drive-by PRs are also welcomed.
Please abide by the Code of Conduct. For more on contributing to OrbitDB, check out the docs in orbitdb/welcome.
License
MIT © 2016-2018 Protocol Labs Inc., Haja Networks Oy
3 years ago
3 years ago
3 years ago
3 years ago
4 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
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