Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
217 commits
Select commit Hold shift + click to select a range
a24209c
docs: add license scan report and status (#2)
fossabot Jul 5, 2018
4c932b7
feat: use custom store
mistakia Jul 20, 2018
725fc16
feat: sync contacts on new contact
mistakia Jul 26, 2018
bc29038
refactor: cleanup api locals
mistakia Jul 26, 2018
9fa9a4a
docs(readme): update api
mistakia Jul 26, 2018
640a388
refactor: add contacts component
mistakia Jul 27, 2018
82200f2
refactor: reduce deps
mistakia Aug 3, 2018
3b3a2cb
feat: add feed
mistakia Jul 25, 2018
33f9979
refactor: improve syntactic sugar
mistakia Aug 4, 2018
76bcee5
refactor: cleanup contact init & sync
mistakia Aug 4, 2018
d678ed8
refactor: reorganize api files + fix contact
mistakia Aug 4, 2018
7cd32c0
feat: add listens
mistakia Aug 4, 2018
9bdbf7f
chore: lint
mistakia Aug 4, 2018
5eaa80f
feat: add tags
mistakia Aug 5, 2018
c77f728
fix: compare clocks on index updates
mistakia Aug 11, 2018
7861979
style: rename rn instances to record
mistakia Aug 12, 2018
0dc27e9
refactor: reorganize api routes
mistakia Aug 12, 2018
0ddd8a8
feat: improve feed schema
mistakia Aug 13, 2018
3da6f3f
fix: indexEntries undefined
mistakia Aug 15, 2018
f676757
fix: filter tracks by tags
mistakia Aug 17, 2018
4021e02
feat: add profile
mistakia Aug 19, 2018
7d87acf
refactor: use address instead of /me
mistakia Aug 24, 2018
a3be107
fix: user profile avatar
mistakia Aug 24, 2018
9552b38
fix: about entry bugs w/ get:feed, get:profile, get:contacts
mistakia Aug 26, 2018
021a2f4
feat: use cli to run multiple nodes on same machine
mistakia Aug 27, 2018
18eaa2c
feat: add record peers
mistakia Aug 27, 2018
483cf3c
feat: add suggested contacts
mistakia Aug 27, 2018
87fc499
fix: dont overwrite logs defaultConfig
mistakia Aug 31, 2018
c970417
fix: update peers list after contact added
mistakia Aug 31, 2018
4f3088b
style: lint
mistakia Sep 2, 2018
3741acc
refactor: RecorStore load
mistakia Sep 2, 2018
ab1865d
fix: only add PUT entries to feed
mistakia Sep 2, 2018
7b9e103
fix: race condition overwrites peer
mistakia Sep 3, 2018
4b1006b
chore: add editorconfig
mistakia Feb 8, 2019
43fe131
feat/update IPFS OrbitDB
mistakia Feb 10, 2019
58ba272
chore: update orbit-db, ipfs-log, orbit-db-store
mistakia May 18, 2019
fc3a9e6
feat: use bitboot to find peers
mistakia May 21, 2019
365c945
feat: validate bitboot ipfs id
mistakia May 22, 2019
583ebb5
docs: update README
mistakia May 22, 2019
6ba71d1
chore: cleanup
mistakia May 22, 2019
5f16b4a
fix: profile bug
mistakia May 24, 2019
f8e6a94
feat: add track from file
mistakia Feb 8, 2019
7e13063
fix: empty about entry bug
mistakia Jun 3, 2019
d33c05e
feat: get random track from log + replace limit with end
mistakia May 24, 2019
5723627
fix: stream fileType detection bug
mistakia Jun 3, 2019
47bb6ce
fix: contacts component typo
mistakia Jun 4, 2019
ea20850
feat: cache & fetch by track resolver ids + use ws for bitboot bootstrap
mistakia Jun 4, 2019
2faecf1
feat: add bitswap and repo stats to info
mistakia Jun 5, 2019
f9aa137
chore: update IPFS, IPFS-Log
mistakia Jun 7, 2019
4665b35
feat: add tracks from FS
mistakia Jun 8, 2019
9d5eeb3
fix: bootstrap logging, init order, contact sync
mistakia Jun 8, 2019
47876cb
test: add test framework + circleci
mistakia Jun 15, 2019
0d1f340
docs: add circleci badge
mistakia Jun 15, 2019
1785af8
fix: update index on large replication
mistakia Jun 11, 2019
819953f
feat: mobile perf + pass in store options
mistakia Jun 16, 2019
c1408c5
refactor: profile -> about, performance, contact syncing
mistakia Jun 17, 2019
ce03de3
Merge branch 'refactor/performance'
mistakia Jun 18, 2019
1e84400
feat: contact replication status events
mistakia Jun 18, 2019
8e2b147
feat: fix index bug with DEL entries
mistakia Jun 21, 2019
68793a1
fix: check if CID before encoding to string
mistakia Jun 22, 2019
3bfdc76
feat: emit event on track added
mistakia Jun 24, 2019
0249337
feat: set haveTrack property for tracks
mistakia Jun 24, 2019
c310aeb
feat: add api route to delete track
mistakia Jun 24, 2019
e0c895e
fix: peer left bug
mistakia Jun 29, 2019
80eb049
feat: add flexsearch index + text query for tracks
mistakia Jun 30, 2019
6cf01b4
refactor: _id => id
mistakia Jun 30, 2019
25f3c19
refactor: better download error message
mistakia Jul 2, 2019
971f9ed
feat: add api routes for contacts.connect/disconnect
mistakia Jul 2, 2019
f4a0997
feat: improve addFromFile for duplicates
mistakia Jul 11, 2019
dc7d63a
fix: express router bug
mistakia Jul 11, 2019
04b36f3
feat/refactor: update libs + load/save index + index processing
mistakia Jul 21, 2019
c824ed1
feat: send contact log size
mistakia Jul 23, 2019
f1935a2
refactor: clean up .info(), use events instead
mistakia Jul 31, 2019
dc806a1
fix: contentCID mismatch bug
mistakia Aug 2, 2019
ce8a690
fix: limit index size/fields
mistakia Aug 2, 2019
de4f97e
feat: version index caches + log loading events
mistakia Aug 5, 2019
da7b105
fix: index object bug
mistakia Aug 6, 2019
50935e0
fix: ignore unindexed feed items for now
mistakia Aug 9, 2019
c712e71
fix: lint + fix interop typo
mistakia Aug 9, 2019
c1715ca
chore: update orbit-db-store orbit-db
mistakia Aug 9, 2019
3e71576
fix: about index bug
mistakia Aug 9, 2019
64cd779
feat: identity + createFromKey + setIdentity
mistakia Jun 10, 2019
7df4707
feat: import/export keys
mistakia Aug 11, 2019
59314db
refactor: cleanup/fix setIdentity
mistakia Aug 11, 2019
fe9905b
fix: export bug with missing id
mistakia Aug 12, 2019
ffe30e7
feat: add api option to load local only ipfs files
mistakia Aug 12, 2019
1f16275
feat: use hashicon instead of jdenticon
mistakia Aug 12, 2019
c19db01
feat: use contact address not id for avatar
mistakia Aug 12, 2019
996faf6
feat: expand contact info with log details
mistakia Aug 12, 2019
45ee02d
feat: index events
mistakia Aug 12, 2019
f1f13ef
fix: track content load bug
mistakia Aug 13, 2019
bf81847
feat: Record.createIdentity()
mistakia Aug 13, 2019
aaf1ea3
docs: add note about fpcalc
mistakia Aug 13, 2019
9aaa65f
fix: file extension bug
mistakia Aug 13, 2019
b3b6483
fix: track content cid mismatches
mistakia Aug 14, 2019
cc142bf
feat: allow adding contact without alias + validate address
mistakia Aug 14, 2019
8407417
feat: support directories on api add track from file
mistakia Aug 14, 2019
37464ff
fix: hashIndex caching + connect/disconnect
mistakia Aug 17, 2019
9256ee7
feat: keep track of local recordstore logs
mistakia Aug 19, 2019
5221561
feat: create multiple recordstore logs
mistakia Aug 20, 2019
25cc5bf
chore: fix circleci
mistakia Aug 20, 2019
81a537a
fix: use name to retrieve existing logs
mistakia Aug 21, 2019
372967d
fix: typo logId destructering
mistakia Aug 22, 2019
d17a448
chore: update circleci config
mistakia Aug 22, 2019
043218f
feat: pin log entries, content, and files
mistakia Aug 30, 2019
39ecf30
feat/gc
mistakia Sep 1, 2019
823bc1d
chore: update keystore
mistakia Sep 7, 2019
a35e26d
fix: load peer log + fix contact pin bug
mistakia Sep 14, 2019
760e4d7
chore: upgrade packages
mistakia Mar 19, 2020
9cdf6dc
feat: share all logs with peers
mistakia Mar 30, 2020
7eb4c7b
fix: log events
mistakia Mar 30, 2020
da791f0
fix: tests + directory + drop store cache
mistakia Mar 31, 2020
d431076
feat: update deps + add stardust
mistakia Apr 3, 2020
30f3595
feat: use single queue to process index entries across logs
mistakia Apr 6, 2020
df15f7f
feat: save indexes on log close
mistakia Apr 7, 2020
fe34696
fix: streaming / file size bug
mistakia Apr 7, 2020
4525aa7
feat: improve indexer + throttle events + improveshutdown
mistakia Apr 7, 2020
050a95b
chore: update fluent-ffmpeg
mistakia Apr 8, 2020
61b09d6
fix: addTrackFromFile bug
mistakia Apr 9, 2020
64f35b7
fix: record peer left event
mistakia Apr 9, 2020
ed548fe
fix: improve add contact speed
mistakia Apr 9, 2020
688e3c7
feat: separate tags from other logs from my tags
mistakia Apr 9, 2020
c31c720
fix: add validation for tags
mistakia Apr 10, 2020
d4c826e
chore: update readme + cleanup
mistakia Apr 10, 2020
f0f4aa0
feat: contact loaded event
mistakia Apr 10, 2020
58f9a7f
fix: index content processor
mistakia Apr 10, 2020
ebda8fc
fix: loadEntryContent
mistakia Apr 10, 2020
3e055f1
docs: add license
mistakia Apr 13, 2020
2a9cd99
feat: improve shuffle
mistakia Apr 13, 2020
2dfc557
fix: track added event format
mistakia Apr 14, 2020
892d7a1
chore: update stardust address
mistakia Apr 15, 2020
f325dee
chore: update deps + use yarn
mistakia Apr 15, 2020
c9ce9c3
feat: add chromaprintPath option
mistakia Apr 16, 2020
6e1f9cd
feat: add youtubedlPath to options
mistakia Apr 16, 2020
33804d8
feat: add dropping logs to api
mistakia Apr 17, 2020
fa12997
fix: build index sequentially
mistakia Apr 17, 2020
85dfad4
fix: key export
mistakia Apr 18, 2020
7c9de3b
feat: purge stale log caches on load
mistakia Apr 18, 2020
07edad6
Update README.md
mistakia Apr 18, 2020
c111675
feat: throttle index updated events
mistakia Apr 19, 2020
9e08345
fix: disconnect from linked log on removal
mistakia Apr 20, 2020
3acce57
refactor: rename contact -> log, use logAddress
mistakia Apr 21, 2020
dfb5e80
fix: peer list & isLinked
mistakia Apr 21, 2020
c60bea3
feat: remove threshold on search
mistakia Apr 21, 2020
13e2576
fix: sharing logs with peers
mistakia Apr 21, 2020
a2302e9
fix: isLinked bug
mistakia Apr 21, 2020
4e7285a
fix: replicate bug
mistakia Apr 21, 2020
80e8e51
feat: emit log loading event
mistakia Apr 21, 2020
26b06f0
fix: typo
mistakia Apr 21, 2020
2d1463b
fix: pubsub-room bug
mistakia Apr 21, 2020
ae7c0e7
fix: api link address
mistakia Apr 21, 2020
f940625
feat: add log.canAppend method
mistakia Apr 22, 2020
c9ac517
feat: enable listens store
mistakia Apr 23, 2020
da1d7aa
feat: improve listen store to include content cid
mistakia Apr 23, 2020
f560f94
feat: on listen add return count
mistakia Apr 23, 2020
870d3df
feat: return listen counts with tracks
mistakia Apr 23, 2020
e3895e2
fix: missing listen count
mistakia Apr 24, 2020
374bfa2
fix: listens api + tracks list params
mistakia Apr 24, 2020
3edeb84
fix: disable pinning
mistakia Apr 24, 2020
fcd8dea
chore: lint
mistakia Apr 24, 2020
b5192c5
feat: add importer
mistakia Apr 25, 2020
b6116b9
feat: improve importer to handle multiple logAddresses
mistakia Apr 25, 2020
e2da276
fix: importer completed files
mistakia Apr 25, 2020
e62ad60
fix: log address bug
mistakia Apr 25, 2020
3f76ec9
fix: shuffling bug
mistakia Apr 25, 2020
9220a1b
fix: addTrackFromFile check fingerprint across logs
mistakia Apr 25, 2020
c603c1e
chore: cleanup tests + add network sync test
mistakia Apr 26, 2020
c4521de
feat: handle importing same file to multiple logs
mistakia Apr 26, 2020
d484382
chore: update deps
mistakia Apr 27, 2020
d6e5ab4
feat: allow ipfs api to be passed in
mistakia Apr 26, 2020
bdbf2b2
fix: remove canvas / avatar generator
mistakia Apr 27, 2020
e7e476e
chore: cleanup / use ipfs-http-client
mistakia May 2, 2020
3765f99
chore: cleanup
mistakia May 4, 2020
6a2519c
feat: enable gc & pinning
mistakia May 6, 2020
b17c485
fix: pin based on trackId
mistakia May 7, 2020
ab6764a
fix: pin all replicated entries by default
mistakia May 7, 2020
f0f5884
fix: listens loading slowly
mistakia May 7, 2020
f78b689
feat: enable importer directory + add importer to api
mistakia May 7, 2020
e293785
fix: importer
mistakia May 8, 2020
b3ba94c
fix: importer events
mistakia May 8, 2020
18668fa
fix: importer + add importer to api
mistakia May 9, 2020
998e4d9
feat: add queue files & errors to importer event
mistakia May 9, 2020
fa1a88a
fix: remove linked log pins
mistakia May 10, 2020
9727514
fix: missing api error statuses
mistakia May 10, 2020
3c784a3
feat: add option for ffmpegPath
mistakia May 15, 2020
bb7cc4e
fix: emit job info on completion
mistakia May 16, 2020
2d43aae
feat: fix url resolver to include playlists/sets
mistakia May 17, 2020
4265f0a
fix: start importing from import directory on restarts/changes
mistakia May 17, 2020
d22e089
fix: disable import diretory by default
mistakia May 17, 2020
c812bca
chore: add comments
mistakia May 20, 2020
46f1a26
fix: add timeout to opening logs
mistakia May 22, 2020
34d2a52
chore: add benchmark runner
mistakia May 25, 2020
56556b4
feat: add indexer
mistakia May 23, 2020
600697e
feat: connect to logs on api fetch log
mistakia Jun 5, 2020
640ba9b
fix: list libraries not linked but already loaded
mistakia Jun 5, 2020
98c303f
fix: tracks sorting
mistakia Jun 6, 2020
798b444
chore: update libs
mistakia Jan 19, 2021
681fb81
chore: update circleci to yarn
mistakia Jan 21, 2021
b1d2c7d
fix: remove crypto-hash dep
mistakia Jan 23, 2021
749aa09
chore: use secp256k1@3.8.0
mistakia Jan 27, 2021
25368a8
fix: libp2p crypto key Uint8Array to Buffer
mistakia Jan 28, 2021
37173e0
fix: catch missing pins error
mistakia Jan 29, 2021
d02d680
docs: update README
mistakia Jan 31, 2021
2d6b5b2
fix: edit linked log alias
mistakia Jan 31, 2021
265cdf2
feat: update about api post response to log.get
mistakia Jan 31, 2021
dbd57aa
chore: update benchmark runnner
mistakia Feb 2, 2021
aa0a367
fix: disable pinning and garbage collection
mistakia Feb 4, 2021
ccd85e3
chore: use shell command for dag get offline
mistakia Feb 14, 2021
ed62afa
docs: update README
mistakia Feb 26, 2021
333f60f
refactor: accept logger in options
mistakia Feb 27, 2021
0c03b13
feat: enable pinning & garbage collection
mistakia Feb 28, 2021
9eb5f73
chore: use github actions
mistakia Feb 28, 2021
efad843
chore: track add index tests
mistakia Feb 28, 2021
0117080
test: tags index checks
mistakia Feb 28, 2021
b06fac0
test: remove track
mistakia Mar 1, 2021
d913404
fix: api logging
mistakia Mar 1, 2021
96981b5
chore(deps): bump lodash from 4.17.20 to 4.17.21
dependabot[bot] May 11, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
root = true
[*/**.js]
indent_style = space
indent_size = 2
84 changes: 84 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
name: Test

on: push

jobs:
linux:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v1

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 12.13.1

- name: Yarn install
run: |
yarn install --frozen-lockfile --network-timeout 300000

- name: Install ffmpeg & chromaprint
run: |
sudo apt-get install software-properties-common
sudo add-apt-repository -y ppa:savoury1/ffmpeg4
sudo apt-get update
sudo apt-get install libchromaprint-tools ffmpeg

- name: Test & Lint
run: |
yarn lint
yarn test

# 'NODE_ENV' is not recognized as an internal or external command
# windows:
# runs-on: windows-latest
# steps:
# - name: Check out Git repository
# uses: actions/checkout@v1

# - name: Install Node.js, NPM and Yarn
# uses: actions/setup-node@v1
# with:
# node-version: 12.13.1

# - name: Yarn install
# run: |
# yarn install --frozen-lockfile --network-timeout 300000

# - name: Install ffmpeg & chromaprint
# run: |
# choco install ffmpeg chromaprint

# - name: Test & Lint
# run: |
# yarn lint
# yarn test

mac:
runs-on: macos-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v1

- name: Install Node.js, NPM and Yarn
uses: actions/setup-node@v1
with:
node-version: 12.13.1

- name: Yarn install
run: |
yarn install --frozen-lockfile --network-timeout 300000

- uses: FedericoCarboni/setup-ffmpeg@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}

- name: Install chromaprint
run: |
brew install chromaprint

- name: Test & Lint
run: |
yarn lint
yarn test
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ yarn-error.log

# App specific
#
orbitdb/
keystore/
cache/
test/tmp/nodes
21 changes: 21 additions & 0 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
78 changes: 58 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,44 @@
<a href="https://bafybeidk4zev2jlw2jijtdyufo3itspx45k4ynq634x4rjm6ycjfdvxfrq.ipfs.infura-ipfs.io/" title="Record">
<img src="https://github.com/mistakia/record-app/raw/master/resources/icon.png" alt="Record Logo" width="150" />
</a>

# Record Node

[![MIT License](http://img.shields.io/badge/license-MIT-blue.svg?style=flat)](LICENSE) [![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com) [![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen.svg?style=flat)](https://github.com/RichardLitt/standard-readme)
[![CircleCI Status](https://circleci.com/gh/mistakia/record-node.svg?style=shield)](https://circleci.com/gh/mistakia/record-node)
[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmistakia%2Frecord-node.svg?type=shield)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmistakia%2Frecord-node?ref=badge_shield)

> Library, CLI and REST API for Record.

A proof of concept distributed social & music application (library, sharing, discovery & curation) network built entirely on [IPFS](https://github.com/ipfs/js-ipfs). User data is stored via a [scuttlebot](http://scuttlebot.io/)-like immutable log via [IPFS-Log](https://github.com/orbitdb/ipfs-log) & [OrbitDB](https://github.com/orbitdb/orbit-db).
Record is a proof of concept immutable distributed system for audio files. Built entirely on [IPFS](https://github.com/ipfs/js-ipfs), user data is stored in a [scuttlebot](http://scuttlebot.io/)-esque immutable log via [IPFS-Log](https://github.com/orbitdb/ipfs-log) & [OrbitDB](https://github.com/orbitdb/orbit-db). Bootstraping/peer discovery is done via [bitboot](https://github.com/tintfoundation/bitboot).

At it's core, the application intends to be a media library management & playback system akin to [beets](https://github.com/beetbox/beets) with the ability to join various sources of music like [tomahawk player](https://github.com/tomahawk-player/tomahawk). By building everything on top of IPFS, it can become a connected network of libraries, opening the door to many other possibilities (i.e. soundcloud & musicbrainz), while still being entirely distributed and thus being able to function permanently.

*Note: View the [UI/UX repo](https://github.com/mistakia/record-app) for more information.*

## Install Dependencies
```
yarn install
```

### Install Chromaprint & FFmpeg

Note: fpcalc ([chromaprint](https://github.com/acoustid/chromaprint)) must be installed to be able to import audio files.
##### OSX using Homebrew
```
brew install chromaprint ffmpeg
```

## Install
##### Ubuntu
```
npm install
sudo apt-get install libchromaprint-tools
```

## Usage

### Running
```
npm run start
yarn start
```

### CLI
Expand All @@ -30,32 +53,47 @@ wip

### Module
```js
const IPFS = require('ipfs')
const RecordNode = require('record-node')
const OrbitDB = require('orbit-db')
const createIPFSDaemon = require('record-ipfsd')

const ipfs = new IPFS()
ipfs.on('ready', async () => {
const rn = new RecordNode(ipfs, OrbitDB)
const ipfsd = await createIPFSDaemon({
repo: repoPath,
ipfsBin: ipfsBinPath
})

await rn.loadLog() // or rn.loadLog('/me')
// User's log loaded
const node = new RecordNode()
node.on('ready', async () => {
const log = await node.log.get() // or node.log.get(record.address)
})
await node.init(ipfsd)
```

## API
### RecordNode Constructor
```js
const rn = new RecordNode(ipfs, OrbitDB, options)
const record = new RecordNode(options)
```
Use the `options` argument to specify configuration. It is an object with any of these properties:
- `orbitPath` (string): The file path passed to OrbitDB. (Default: `undefined`)
- `orbitAddress` (string): Valid OrbitDB database address. (Default: `undefined`)
- `api` (boolean or object): Initialize the api when creating Record Node instance (Default: `undefined`)
- `logConfig` (object): Options passed to OrbitDB when creating log.
- `create` (boolean): Wether or not to create db if given just a db name (Default: `true`)
- `replicate` (boolean): Subscribe to updates via IPFS pubsub (Default: `true`)
- `replicationConcurrency` (integer): (Default: `128`)
View default options at [`config.js`](https://github.com/mistakia/record-node/blob/master/config.js). Use the `options` argument to specify configuration. It is an object with any of these properties:

##### `options.api`

| Type | Default |
|------|---------|
| boolean | `false` |
| object | `{ port: 3000 }` |

Enable http api (Default: `undefined`)

##### `options.bitboot`

| Type | Default |
|------|---------|
| object | `{ enabled: true }` |

Enable finding peers via [bitboot](https://github.com/tintfoundation/bitboot)

## License
MIT


[![FOSSA Status](https://app.fossa.io/api/projects/git%2Bgithub.com%2Fmistakia%2Frecord-node.svg?type=large)](https://app.fossa.io/projects/git%2Bgithub.com%2Fmistakia%2Frecord-node?ref=badge_large)
43 changes: 0 additions & 43 deletions api.js

This file was deleted.

30 changes: 30 additions & 0 deletions benchmark/benchmarks/add-tracks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
const { startRecord, createTrack } = require('../../test/utils')

const base = {
prepare: async function () {
return startRecord('0')
},
cycle: async function ({ record }, { count }) {
await record.tracks.add(createTrack(`Hello${count}`))
},
teardown: async function ({ record }) {
await record.stop()
}
}

const baseline = {
while: ({ stats, startTime, baselineLimit }) => {
return stats.count < baselineLimit
}
}

const stress = {
while: ({ stats, startTime, stressLimit }) => {
return process.hrtime(startTime)[0] < stressLimit
}
}

module.exports = [
{ name: 'add-tracks-baseline', ...base, ...baseline },
{ name: 'add-tracks-stress', ...base, ...stress }
]
19 changes: 19 additions & 0 deletions benchmark/benchmarks/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const addTracks = require('./add-tracks')
const listTracks = require('./list-tracks')

// TODO add links
// TODO list links
// TODO listens
// TODO list tags
// TODO list listens
// TODO remove tracks
// TODO remove tags
// TODO remove links

// TODO replicate
// TODO process index

module.exports = [
...addTracks,
...listTracks
]
43 changes: 43 additions & 0 deletions benchmark/benchmarks/list-tracks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
const { startRecord, createTrack } = require('../../test/utils')

const base = {
prepare: async function () {
const { record } = await startRecord('0')

process.stdout.clearLine()
for (let i = 1; i < this.count + 1; i++) {
process.stdout.write(`\r${this.name} - Preparing - Writing: ${i}/${this.count}`)
await record.tracks.add(createTrack(`Hello${i}`))
}

return { record }
},
cycle: async function ({ record }, { count }) {
await record.tracks.list({ addresses: [record.address] })
},
teardown: async function ({ record }) {
await record.stop()
}
}

const baseline = {
while: ({ stats, startTime, baselineLimit }) => {
return stats.count < baselineLimit
}
}

const stress = {
while: ({ stats, startTime, stressLimit }) => {
return process.hrtime(startTime)[0] < stressLimit
}
}

const counts = [100, 500, 1000]
const benchmarks = []
for (const count of counts) {
const c = { count }
benchmarks.push({ name: `list-tracks-${count}-baseline`, ...base, ...c, ...baseline })
benchmarks.push({ name: `list-tracks-${count}-stress`, ...base, ...c, ...stress })
}

module.exports = benchmarks
Loading