2.0.0 • Published 1 year ago

orbit-db-eventstore v2.0.0

Weekly downloads
1,198
License
MIT
Repository
github
Last release
1 year ago

orbit-db-eventstore

npm version Gitter Matrix

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 ipfs

Usage

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

2.0.0

1 year ago

2.0.1-cb7f06c.0

1 year ago

1.12.0

4 years ago

1.11.0

4 years ago

1.10.0

4 years ago

1.9.0

4 years ago

1.8.0

4 years ago

1.7.0

4 years ago

1.6.0

5 years ago

1.6.0-rc1

5 years ago

1.5.1

5 years ago

1.4.1

5 years ago

1.5.0

5 years ago

1.5.0-rc3

5 years ago

1.5.0-rc.2

5 years ago

1.5.0-rc.1

5 years ago

1.4.0

6 years ago

1.3.1

6 years ago

1.3.0

6 years ago

1.2.0

6 years ago

1.1.3

6 years ago

1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

6 years ago

1.0.0

6 years ago

0.2.0

7 years ago

0.1.9

7 years ago

0.1.8

7 years ago

0.1.7

7 years ago

0.1.6

7 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago

0.0.20

8 years ago

0.0.19

8 years ago

0.0.18

8 years ago

0.0.17

8 years ago

0.0.16

8 years ago

0.0.15

8 years ago

0.0.14

8 years ago

0.0.13

8 years ago

0.0.12

8 years ago

0.0.11

8 years ago

0.0.10

8 years ago

0.0.9

8 years ago

0.0.8

8 years ago

0.0.7

8 years ago

0.0.6

8 years ago

0.0.5

8 years ago

0.0.4

8 years ago

0.0.3

8 years ago

0.0.2

8 years ago