js-ipfs icon indicating copy to clipboard operation
js-ipfs copied to clipboard

feat: reprovider

Open vasco-santos opened this issue 5 years ago • 6 comments

In the context of js-ipfs reannouncing blocks to the network ipfs/js-ipfs#2160, this PR aims to add a Provider layer controlled by js-ipfs. This provider will be used by bitswap.

Needs:

vasco-santos avatar Jun 17 '19 13:06 vasco-santos

@alanshaw @dirkmc could I get your feedback on this PR?

It is important to also look at the bitswapPR in this context.

FYI, for getting this to the finish line I only need to add the proper logic for the reprovide strategies. However, there is some code in Dirk's PR for the garbage collection ipfs/js-ipfs#2022 that would be great to use for this. So, it would be great to have that merged first.

vasco-santos avatar Jun 27 '19 15:06 vasco-santos

Looks like it's on the right track @vasco-santos 👍 I left a few comments for minor things in the code.

I wonder if it would make sense to persist the time at which the last provide occurred, so that if a node restarts it doesn't wait the full 12 hours to reprovide?

dirkmc avatar Jun 27 '19 16:06 dirkmc

Thanks @dirkmc ! I think that I addressed all your comments!

Regarding persisting the time of the last provide, the first reprovide will happen once the node starts, after a short delay. So, I think it should not be necessary

vasco-santos avatar Jun 28 '19 10:06 vasco-santos

@vasco-santos what's the status of this PR - still draft?

alanshaw avatar Aug 27 '19 08:08 alanshaw

I was waiting on https://github.com/ipfs/js-ipfs/pull/2022 getting merged, which had a lot of useful code to integrate here without duplicating.

vasco-santos avatar Aug 27 '19 08:08 vasco-santos

Hi! js-ipfs master just got a whole new set of automated tests with #2528, https://github.com/ipfs/js-ipfs/pull/2440 and also running some of the test suites from our early testers (hi5 to @achingbrain for setting it all up!). Would you mind rebasing the master branch on this PR to ensure it runs all the latest tests? Thank you!

daviddias avatar Oct 11 '19 15:10 daviddias

I'm going to close this because I think since the .provide method lives on libp2p's ContentRouter interface, re-provides should be handled by the various implementations of content routers since they all may have different rules about provider record validity, etc.

Some may call out to a remote service that does the re-provide for us, for example, or some may have shorter lived records than others, who knows!

achingbrain avatar Jun 02 '23 16:06 achingbrain