-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Conversation
} | ||
|
||
let rs = new Readable() | ||
rs.cancel = () => self._floodsub.subscribe(topic) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should prolly be unsubscribe
, right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @haadcode thank you.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed 👍
I think we agreed in the API discussion to go with Would be good if the API in this PR would be changed to that too. @gavinmcdermott what do you think? |
log.error = debug('cli:floodsub:error') | ||
|
||
module.exports = { | ||
command: 'pub <topic> <message>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should use <data>
here as we do in go-ipfs (https://github.com/ipfs/go-ipfs/blob/master/core/commands/pubsub.go#L198), just to make it clear that there isn't a specific type of message but rather one can send any data as the message. Not super settled on this, so take it as a proposal :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry if I missed that (and I do like the full name convention). If you're good with it, I'll make that change to sync up with what you folks already agreed on.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Addressed 👍
log.error = debug('cli:floodsub:error') | ||
|
||
module.exports = { | ||
command: 'start', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should prolly not have a separate command to start the pubsub but rather it should start "automatically" either on ipfs instance start (in goOnline() perhaps) or when subscribed to the first topic.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree with not having a start command. In an initial version I had it initialize when a call to pub
or sub
was made. My further comments on this are below :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, the floodsub routine should start when a daemon goes online.
Thank you @gavinmcdermott! This looks great! Left a couple of small comments. One bigger one we should discuss is the separate |
Thank you for the feedback and thoughts @haadcode - I really appreciate it! I agree with not having a start command. In an initial version I had it initialize when a call to So perhaps the best near term step, which you arrived at above, is to initialize |
Hey @haadcode: latest changes are up and I made updates based on all comments except the one regarding the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking good! :D Super happy to see floodsub being added. Thank you @gavinmcdermott !
@haadcode does this mean that this PR #531 won't be needed anymore?
log.error = debug('cli:floodsub:error') | ||
|
||
module.exports = { | ||
command: 'start', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, the floodsub routine should start when a daemon goes online.
log.error = debug('cli:floodsub:error') | ||
|
||
module.exports = { | ||
command: 'subscribe <topic>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have an alias as sub
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diasdavid: Is the intention for this to be aliased from the top level as: jsipfs sub <some topic>
or from the module as: jsipfs floodsub sub <topic>
?
log.error = debug('cli:floodsub:error') | ||
|
||
module.exports = { | ||
command: 'unsubscribe <topic>', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we have an alias as unsub
?
} | ||
|
||
self._floodsub = new FloodSub(self._libp2pNode) | ||
return callback(null, self._floodsub) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I believe it doesn't have to return the floodsub instance, as it gets available in the self object
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call
|
||
subscribe: promisify((topic, options, callback) => { | ||
// TODO: Clarify with @diasdavid what to do with the `options.discover` param | ||
// Ref: https://github.com/ipfs/js-ipfs-api/pull/377/files#diff-f0c61c06fd5dc36b6f760b7ea97b1862R50 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've answered somewhere, but just to keep track: Currently we do nothing as js-ipfs doesn't have the go-ipfs DHT
data: data.toString(), | ||
topicIDs: [topic] | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This might cause an error that if I call subscribe on the same topic twice, I'll start seeing the same message being emitted twice as well
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Now handled
callback(null) | ||
}), | ||
|
||
unsubscribe: promisify((topic, callback) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a topic is unsubscribed, all of the event listeners for those topics should be unregistered as well, otherwise this will cause an eventual memory leak
stream._read = () => {} | ||
stream._readableState = {} | ||
} | ||
return reply(stream) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have a hunch that this won't work. This stream of objects needs to be converted to ndjson stream
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@diasdavid - I discovered the pull-ndjson
module you published; any examples of the ndjson
module being used in the ecosystem?
}) | ||
}) | ||
}) | ||
}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be awesome to have these tests as part of interface-ipfs-core, so that we can use the same tests for js-ipfs and js-ipfs-api, making sure that both implementations follow the same interface.
See https://github.com/ipfs/interface-ipfs-core/tree/master/src for examples in how to achieve this.
@@ -20,7 +20,7 @@ module.exports = (repoPath, opts) => { | |||
env.IPFS_PATH = repoPath | |||
|
|||
const config = Object.assign({}, { | |||
stipEof: true, | |||
stripEof: true, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice catch 👍 //cc @dignifiedquire
No problem, rebasing and rewording should be a jiffy :) Thank you for adopting it! |
It'd be great @gavinmcdermott if you could make it to the js-ipfs or libp2p call tonight and we could all check in on the various pubsub efforts. Totally fine if you can't make it, we can continue here and in various other related issues. There's a lot going on and I would like to make sure we're all on the same page as to a) what we need to do next and b) who's doing what, so that we avoid duplicated work and we can unify our efforts. |
@haadcode - Sorry for the delayed reply here—and I agree that syncing up would be great! I emailed @diasdavid yesterday weekend to let him know my status—I'm off to the backcountry for the next week starting tomorrow. Today was a travel day for me, and I'll have a connection until we head out tomorrow. SyncingIf a call can't be managed, how about connecting over email? Feel free to drop me a line at gavinmcdermott@gmail.com, I'll have connection for a short while here. Sorry for the poor timing! Latest CommentsI'll work on those changes. Question on Init@diasdavid / @haadcode - I initially had Any ideas on:
Regardless, it'll get sorted out - so thanks for any ideas! |
@gavinmcdermott have a great holiday in the backcountry! :) We'll sync properly when you get back. Unfortunately I have no idea re. the issue you're having re. connections and libp2p, that's all @diasdavid. I've been working on the tests and js-ipfs-api implementation for pubsub. The short is: there were couple of bugs that made it tricky but there's PRs being merged as we speak and I expect we'll have a solid working version of go-ipfs pubsub sometime this week. Along with that, the js-ipfs-api implementation is almost complete and can be found here https://github.com/haadcode/js-ipfs-api/blob/fix/pubsub/src/api/pubsub.js. What is missing is pubsub/topics command but otherwise it's done. It was fairly tricky with the Stream so I highly recommend to take a look how I ended up structuring the code and what's doing what. This might be different on js-ipfs side, though. I think you might be able to use the PubsubMessage class for encapsulating the messages coming from floodsub, but you might not (as the data types might be different between js-ipfs and go-ipfs), so take a look and see if there's anything useful for you. The good news is that there's not a fairly good test suite for pubsub which I plan to PR o interface-core as @diasdavid proposed somewhere. It might be helpful for you @gavinmcdermott to try running js-ipfs code against the same tests: https://github.com/haadcode/js-ipfs-api/blob/fix/pubsub/test/ipfs-api/pubsub.spec.js even if they're not in interface-core yet. |
Tests are now in ipfs-inactive/interface-js-ipfs-core#101. I'll try to run them against your PR @gavinmcdermott and see what comes out. |
@gavinmcdermott branched off from your floodsub branch and added the interface-ipfs-core tests, can't quite get my head around to push/PR to your repo but here's the relevant code: 699bd25. Once you have that, you need to checkout this PR ipfs-inactive/interface-js-ipfs-core#101 and run That said, the tests are NOT passing as the very first throw "Floosub not started" (expected). If I start floodsub in go-online, js-ipfs tests just fail silently and don't give me any feedback as to why :/ Hope this helps. |
Heads-up: pubsub.ls() and pubsub.peers() are not yet implemented in libp2p-floodsub (they're required to satisfy the api). |
@gavinmcdermott I did some quick hacks trying to get the tests work. Can run some of them now: 6efd705. |
Thanks @haad! I've been seeing your messages come through - Today is my
last travel day as I head back to SF. I'll hop on to the call from a coffee
shop, but plan on my being available this week to get things landed.
Looking forward to it. Thanks for the updates in the interim and talk soon!
On Mon, Dec 5, 2016 at 9:39 AM Haad ***@***.***> wrote:
@gavinmcdermott <https://github.com/gavinmcdermott> I did some quick
hacks trying to get the tests work. Can run some of them now: 6efd705
<6efd705>
.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#610 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AASfggj87hHqagdXOyWhHcuIKZaeC6dDks5rFD4_gaJpZM4K3Cv2>
.
--
Sent from Gmail Mobile
|
Update for @haadcodeThis evening I am in the middle of two work items primarily:
Here are the updated ecosystem packages I'm now building against:
I think these are the latest based on the updates today. One item I did not get around to fixing (yet) is the issue with Floodsub initializing in Goal for tomorrowMy goal tomorrow is to get the above commit up for your review and get us into the home stretch! As a heads up, I'll be heading down to meet with David on Thursday to work on things...so we can also use that day to knock out any outstanding issues that are left after the next 36 hours. Thanks and please let me know if you have any thoughts on this. |
@gavinmcdermott Thanks for the update! I just got up and once I've finished my coffee, will take a look at what you and @diasdavid did last night and pick up what I can. Will keep you updated on progress. |
Awesome \o/ excited to get this in. I'm sure that after getting this merged, there will be need some interop testing of a orbit+go-ipfs and orbit+js-ipfs, but with this PR we get closer to that than ever :) @gavinmcdermott I've invited you to the JavaScript team at the IPFS org a while ago: I was going to do this, but since there is CR that still needs to be addressed here, I didn't want to loose it. Will you be around today, @gavinmcdermott ? |
@diasdavid: For some reason, I don't have any pending invites in my account. Would you mind cancelling and re-inviting? Regarding your pending CR: I intend to wrap that up today, and will be working on it primarily. Aside from a brief hackathon I'm running today from 11-3 (Pacific), I'm focused on this. Feel free to ping me over email / IRC whenever and I'll be responsive as quickly as possible in the interim. |
@gavinmcdermott sounds good :) Good luck for the hackathon! re: invite: I need to ask @whyrusleeping or @jbenet to do it, once I get the hang of them, I'll ask, meanwhile, if you open https://github.com/ipfs, it doesn't show to you? |
@diasdavid: Just opened the link and it was waiting for me - all good! |
@diasdavid - since the E.g.: I'll also change over the directory / test names as well. |
@gavinmcdermott yeah, what happened is that we reached consensus to make |
Update for @haadcode and @diasdavid: Today:
Tonight: Tomorrow: |
Sounds great! Looking forward to check this. I'll have time today to work on this, so perhaps there's a little more there when you wake up tomorrow :) |
And thank you for keeping everyone so well updated! It's crucial when working on the same thing as a team. |
@haadcode - The first batch of core interface tests are passing. I'm now running into an issue in the I tried connecting the nodes manually in the before setup (see below) and a few other things, but before spending much more time, I wanted to see if you had any guidance... (cb) => {
ipfs1._libp2pNode.dialByPeerInfo(ipfs2._peerInfo, (err) => {
expect(err).to.not.exist
cb()
})
} Thank you in advance! |
The idea for those tests is to test that two peers can send and receive messages from/to each other in pubsub. pubsub.peers is supposed to return a list of peers who are connected to the same topic. If that doesn't return peers, then they're not considered connected. How go-ipfs works is that it has the discovery flag which I guess makes it look for peers automatically. Since we can't do that in js-ipfs due to lacking DHT, we probably need to connect the two nodes manually in the tests. However, when I run js-ipfs instances, they usually get connected. But perhaps we don't have discovery on js-ipfs, or whatever reason, the nodes don't seem to get connected, or at least the information that they're connected doesn't get all the way to pubsub.peers. Does that make sense? If you have network/connectivity problems, that's all @diasdavid and he'll be able to help out. |
@gavinmcdermott when you're done with your day, ping me here and I can pick it up and see if I can get further. |
I'm going to merge this branch of a fork into a branch of this repo -- |
Note: I discovered the commit guidelines after I'd committed some things and synced with upstream, so I apologize for the messy history here.
Here's an initial pass at the FloodSub implementation. There's a bit of conversation on this in various threads (this
js-ipfs-api
PR, and some other general API discussion). That said, I wanted to get this up for comments. Thanks in advance, folks.cc: @diasdavid @dignifiedquire