From e40aec6531097ce1b07fb21a56a83bc281750b0a Mon Sep 17 00:00:00 2001 From: Vasco Santos Date: Thu, 14 Feb 2019 10:59:52 +0000 Subject: [PATCH] docs: overwritten functions --- .travis.yml | 28 ++++++++++++++++++++++++++++ README.md | 6 +++++- ci/Jenkinsfile | 2 -- package.json | 2 ++ 4 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 .travis.yml delete mode 100644 ci/Jenkinsfile diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000000..87c129ed56 --- /dev/null +++ b/.travis.yml @@ -0,0 +1,28 @@ +language: node_js +cache: npm +stages: + - check + - test + - cov + +node_js: + - '10' + +os: + - linux + - osx + - windows + +script: npx nyc -s npm run test -- --bail +after_success: npx nyc report --reporter=text-lcov > coverage.lcov && npx codecov + +jobs: + include: + - stage: check + script: + - npx aegir commitlint --travis + - npx aegir dep-check + - npm run lint + +notifications: + email: false diff --git a/README.md b/README.md index 753a070920..62ee6dafae 100644 --- a/README.md +++ b/README.md @@ -32,7 +32,11 @@ js-libp2p-pubsub ## Usage -A pubsub implementation **MUST** override the `_processConnection`, `publish`, `subscribe` and `unsubscribe` functions. `add_peer` and `remove_peer` may be overwritten if the pubsub implementation needs to add custom logic when peers are added and remove. All the remaining functions **MUST NOT** be overwritten. +A pubsub implementation **MUST** override the `_processConnection`, `publish`, `subscribe` and `unsubscribe` functions. + +Other functions, such as `_addPeer`, `_removePeer`, `_onDial`, `start` and `stop` may be overwritten if the pubsub implementation needs to add custom logic on them. It is important pointing out that `start` and `stop` must call `super`. The `start` function is responsible for mounting the pubsub protocol onto the libp2p node and sending its' subscriptions to every peer conneceted, while the `stop` function is responsible for unmounting the pubsub protocol and shutting down every connection + +All the remaining functions **MUST NOT** be overwritten. The following example aims to show how to create your pubsub implementation extending this base protocol. The pubsub implementation will handle the subscriptions logic. diff --git a/ci/Jenkinsfile b/ci/Jenkinsfile deleted file mode 100644 index a7da2e54f3..0000000000 --- a/ci/Jenkinsfile +++ /dev/null @@ -1,2 +0,0 @@ -// Warning: This file is automatically synced from https://github.com/ipfs/ci-sync so if you want to change it, please change it there and ask someone to sync all repositories. -javascript() diff --git a/package.json b/package.json index 7ba967a697..a2cbe1356b 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,9 @@ "err-code": "^1.1.2", "length-prefixed-stream": "^1.6.0", "protons": "^1.0.1", + "pull-length-prefixed": "^1.3.1", "pull-pushable": "^2.2.0", + "pull-stream": "^3.6.9", "time-cache": "~0.3.0" }, "contributors": [