diff --git a/README.md b/README.md index 2e45aed..1beb93f 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,40 @@ npm install orbit-db ``` ## Examples + +### Browser examples +Build the examples: +```bash +npm install +npm run build:examples +``` + +Then open `examples/browser.html` or `examples/index.html`. See the full example [here](https://github.com/haadcode/orbit-db/blob/master/examples/browser/browser.html). + +```html + + + + + + + + + + + + +``` + ### Node.js examples *To run the examples, make sure to run a local [orbit-server](https://github.com/haadcode/orbit-server)* @@ -71,40 +105,6 @@ Benchmark writes: node examples/benchmark.js ; ``` - -### Browser examples -Build the examples: -```bash -npm install -npm run build:examples -``` - -Then open `examples/browser.html` or `examples/index.html`. See the full example [here](https://github.com/haadcode/orbit-db/blob/master/examples/browser.html). - -```html - - - - - - - - - - - - -``` - ## API **NOTE: the API documentation is currently out of date. It will be updated soon!** @@ -183,8 +183,6 @@ async(() => { ``` ### Development -#### Source Code -The entry point for the code is [src/Client.js](https://github.com/haadcode/orbit-db/blob/master/src/Client.js) and the DB implementation is [src/OrbitDB.js](https://github.com/haadcode/orbit-db/blob/master/src/OrbitDB.js) #### Run Tests ```bash @@ -201,83 +199,3 @@ mocha -w npm install npm run build ``` -### TODO -- make ipfs-log emit events ('data', 'load') - - Store: this._log.events.on('data', (log, entries) => this._index.updateIndex(log, entries)) -- merge 'readable' and 'data' events (only one) - -## Notes -### Data structure description -*For future [IPLD](https://github.com/ipfs/ipld-examples) references* - -List snapshots are posted to pubsub: -``` -> QmRzWAiFdLkdkwBDehzxhHdhfwbDKDnzqBnX53va58PuQu -> ... -``` - -**Get a list snapshot** - -`ipfs object get QmRzWAiFdLkdkwBDehzxhHdhfwbDKDnzqBnX53va58PuQu` -```json -{ - "Links": [], - "Data": { - "id": "user123", - "items": [ - "QmNwREbsgGgiQPXxpvGanD55inFjUXjpEqjiPtpa39P7Mn", - "QmQxndNEzWxKT5KRqRsty7JDGcbPVazaYPCqfB5z1mxmon", - "QmUN1X97M2t8MX55H8VoPGXu2fLBpr91iCAzHkXudSMvDE" - ] - } -} -``` - -**Get the item** - -`ipfs object get QmNwREbsgGgiQPXxpvGanD55inFjUXjpEqjiPtpa39P7Mn` -```json -{ - "Links": [], - "Data": { - "id": "user123", - "data": "QmasZEUwc67yftPvdSxRLWenmvF8faLnS7TMphQpn4PCWZ", - "next": [ - "QmS17ABxzFEVoHv5WEvATetNEZhN2vkNApRPcFQUaJfij3" - ] - } -} -``` - -**Get the item's data (operation)** - -`ipfs object get QmasZEUwc67yftPvdSxRLWenmvF8faLnS7TMphQpn4PCWZ` -```json -{ - "Links": [], - "Data": { - "op": "PUT", - "key": "default", - "value": "QmaAPEKDdaucQZRseJmKmWwZhgftBSwj8TD1xEomgcxo1X", - "meta":{ - "type": "text", - "size": -1, - "from": "user123", - "ts": 1456494484094 - } - } -} -``` - -**Get the value** - -`ipfs object get QmaAPEKDdaucQZRseJmKmWwZhgftBSwj8TD1xEomgcxo1X` -```json -{ - "Links": [], - "Data": { - "content": "LambOfGod 347", - "ts": 1456494484089 - } -} -```