-
Notifications
You must be signed in to change notification settings - Fork 17
Conversation
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 add more documentation, and potentially an example for extending pubsub.
Looking through the code, it's not clear to me what methods I should be overriding, what I should avoid overriding, and if there are any methods I must call super
on.
If I override _addPeer
will bad things happen? Are there minimum methods I need to override to implement a custom pubsub algorithm? The usage section might be sufficient for describing this, but perhaps method comments there would be appropriate? My thoughts are trying to convey something similar to the nodejs stream implementation guidelines, for example the MUST NOT
language at https://nodejs.org/docs/latest-v10.x/api/stream.html#stream_writable_write_chunk_encoding_callback_1
2f86aeb
to
1f9bdd8
Compare
Updated @jacobheun Can you have a look? |
I noticed that the updated docs say that you must not override |
Thanks for your feedback @Mikerah ! You are right and I will change it. Perhaps document that From your perspective, do you think the rest of the documentation is clear enough and suit |
1f9bdd8
to
d9734da
Compare
d9734da
to
88dc3f7
Compare
I think adding more JS docs to the functions might be helpful. It took me a while to figure out what each function took as input and what exactly they returned. Also, what's the reasoning for creating a separate Another thing that I noticed is that in the Go pubsub router, it contains this variable |
I added docs as @jacobheun suggested. Did you see the last version? You can point me to the ones that are less clear and we can try to improve them.
From my quick analysis, we use it essentially for combining the
I believ it should be useful in JS land too! I believe that it may be useful across all implementations. Can you open an issue for that? |
What I mean by extra documentation is to add @params and @types to function definitions and variables. The |
I agree. I think once we have those documented we can merge this and then iterate from there. |
Totally agree with you @Mikerah One of our goals is to add better documentation (as you suggested) to all We should move this PR forward now and tackle the documentation improvements later. If you are willing to help, we are open to receive PRs. |
88dc3f7
to
2dafd3f
Compare
Meanwhile, I added the documentation for private functions. We should add examples and a better documentation in the |
2dafd3f
to
7e36810
Compare
7e36810
to
326d73d
Compare
This is good to merge, we can iterate from here. |
In the context of creating
js-libp2p-gossipsub
, we extracted the base protocol ofjs-libp2p-floodsub
to its own module.