Skip to content
This repository has been archived by the owner on Feb 12, 2024. It is now read-only.

Feature: PubSub 🌟 #644

Merged
merged 55 commits into from
Jan 16, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
55 commits
Select commit Hold shift + click to select a range
d6c6d12
fix cli test typo
gavinmcdermott Nov 12, 2016
641fe1c
wip: floodsub now in api-routes, api-resources, and core-components
gavinmcdermott Nov 12, 2016
d3c4f02
Initial core tests pass
gavinmcdermott Nov 16, 2016
9026a88
Merge with master
gavinmcdermott Nov 16, 2016
9b7da97
feat(api, cli, core): add floodsub
gavinmcdermott Nov 17, 2016
adeccec
Merge branch 'master' into feature-floodsub
gavinmcdermott Nov 18, 2016
94bbc43
refactor(api, cli, core): update floodsub to a full name API
gavinmcdermott Nov 20, 2016
4ee7b5b
chore: merge upstream/master
gavinmcdermott Dec 6, 2016
5031470
chore: address CR comments
gavinmcdermott Dec 8, 2016
8084cb5
fix: fix lint issues
gavinmcdermott Dec 8, 2016
3cdfcb0
Merge pull request #610 from gavinmcdermott/feature-floodsub
daviddias Dec 8, 2016
3b365f7
update dep
daviddias Dec 8, 2016
faa6e33
Fix canceling subscription. Move subscription state to be local to th…
haadcode Dec 9, 2016
6ba150c
fix: typo in bitswap core
gavinmcdermott Dec 10, 2016
7d17a86
chore: update deps
daviddias Dec 11, 2016
ba12388
fix: no more infinite buffering of messages
daviddias Dec 11, 2016
39db7df
fix: wip - cancel relevant subscribe events
gavinmcdermott Dec 12, 2016
d2e6f6e
fix: no dangling listeners, multiple subscribers. pass all the tests …
daviddias Dec 12, 2016
deb5fd6
test: get http tests passing (except subscribe)
gavinmcdermott Dec 12, 2016
a89301b
fix cli test typo
gavinmcdermott Nov 12, 2016
9c82402
wip: floodsub now in api-routes, api-resources, and core-components
gavinmcdermott Nov 12, 2016
7f1eca4
Initial core tests pass
gavinmcdermott Nov 16, 2016
4233e53
feat(api, cli, core): add floodsub
gavinmcdermott Nov 17, 2016
186c5d2
refactor(api, cli, core): update floodsub to a full name API
gavinmcdermott Nov 20, 2016
093897b
chore: address CR comments
gavinmcdermott Dec 8, 2016
d4e9efa
fix: fix lint issues
gavinmcdermott Dec 8, 2016
580313a
update dep
daviddias Dec 8, 2016
ca9c0ea
Fix canceling subscription. Move subscription state to be local to th…
haadcode Dec 9, 2016
43045f5
fix: typo in bitswap core
gavinmcdermott Dec 10, 2016
467a9a9
chore: update deps
daviddias Dec 11, 2016
a302b25
fix: no more infinite buffering of messages
daviddias Dec 11, 2016
2d829f8
fix: wip - cancel relevant subscribe events
gavinmcdermott Dec 12, 2016
5a5a810
fix: no dangling listeners, multiple subscribers. pass all the tests …
daviddias Dec 12, 2016
82aba1e
chore: update deps
daviddias Dec 13, 2016
8d855c2
fix: subscribe returns a valid stream
gavinmcdermott Dec 16, 2016
b32af31
fix: fix lint issues; comment out pubsub cli
gavinmcdermott Dec 17, 2016
c457bf7
update to the latest floodsub
dignifiedquire Dec 18, 2016
65fe21c
Merge remote-tracking branch 'origin/master' into feat/pubsub
dignifiedquire Dec 18, 2016
ea458ee
simple cli and http tests passing
dignifiedquire Dec 18, 2016
3e29f95
new events based api done and http-api with ipfs-interface-core testing
dignifiedquire Dec 19, 2016
350a854
pubsub: fix peers implementation and test
dignifiedquire Dec 20, 2016
b5b4739
apply some cr
dignifiedquire Dec 21, 2016
6465bb5
better error handling
dignifiedquire Dec 21, 2016
d19864a
Merge branch 'master' into feat/pubsub
daviddias Dec 21, 2016
966b597
chore(deps): use interface-ipfs-core release
dignifiedquire Dec 21, 2016
c206800
chore: update deps
daviddias Dec 23, 2016
249bca1
Merge remote-tracking branch 'origin/master' into feat/pubsub
dignifiedquire Dec 23, 2016
9371b67
(wip) fix: pubsub closes its conns
daviddias Dec 30, 2016
50ae06d
feat(pubsub): update to new floodsub
daviddias Jan 9, 2017
9b1aea7
fix: let protocols initiate properly
daviddias Jan 10, 2017
aa29598
chore: update deps
daviddias Jan 10, 2017
4495b3a
fix: remove delay
daviddias Jan 10, 2017
3082c2f
chore: update deps
daviddias Jan 11, 2017
0208504
fix: setImmediate erros as well, update interface-ipfs-core
daviddias Jan 12, 2017
738c55c
Merge branch 'master' into feat/pubsub
daviddias Jan 16, 2017
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
Prev Previous commit
Next Next commit
fix: setImmediate erros as well, update interface-ipfs-core
  • Loading branch information
daviddias committed Jan 16, 2017
commit 02085040b83476962962369d56884e3ca170a90f
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
"form-data": "^2.1.2",
"fs-pull-blob-store": "^0.4.1",
"gulp": "^3.9.1",
"interface-ipfs-core": "^0.23.2",
"interface-ipfs-core": "^0.23.3",
"ipfsd-ctl": "^0.18.1",
"left-pad": "^1.1.3",
"lodash": "^4.17.4",
Expand Down
13 changes: 6 additions & 7 deletions src/core/components/pubsub.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,20 @@ module.exports = function pubsub (self) {

publish: promisify((topic, data, callback) => {
if (!self.isOnline()) {
throw OFFLINE_ERROR
return setImmediate(() => callback(OFFLINE_ERROR))
}

if (!Buffer.isBuffer(data)) {
return callback(new Error('data must be a Buffer'))
return setImmediate(() => callback(new Error('data must be a Buffer')))
}

self._pubsub.publish(topic, data)

setImmediate(callback)
setImmediate(() => callback())
}),

ls: promisify((callback) => {
if (!self.isOnline()) {
throw OFFLINE_ERROR
return setImmediate(() => callback(OFFLINE_ERROR))
}

const subscriptions = Array.from(
Expand All @@ -70,7 +69,7 @@ module.exports = function pubsub (self) {

peers: promisify((topic, callback) => {
if (!self.isOnline()) {
throw OFFLINE_ERROR
return setImmediate(() => callback(OFFLINE_ERROR))
}

const peers = Array.from(self._pubsub.peers.values())
Expand All @@ -93,6 +92,6 @@ module.exports = function pubsub (self) {
}

ps.on(topic, handler)
setImmediate(callback)
setImmediate(() => callback())
}
}