-
Notifications
You must be signed in to change notification settings - Fork 97
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
pinning/pinner: Pinner should not be tasked to fetch blocks #378
Comments
On an intuition level, this has a similar vibe as having the caller side of bitswap adding blocks in storage (ipfs/go-bitswap#571), which helped splitting client and server side, among other things. |
cc @Jorropo for visibility, I remember you were suggesting refactoring the way we do fetch during pinning |
The pinner keeps track of long term state in it's internal pin database, it also keep track of state in the blockstore, it would be VERY weird if it kept track of some state but not all of it (if we still had the internal DB but not the blockstore part of it). Currently it does not even store the blocks directly, it relies on side effect of the blockservice (blockservice stores all block downloaded). Also unlike ipfs/go-bitswap#571 where there was a bug where blocks were local puts were duplicated (once in blockservice and once in bitswap), I am not aware of any bug here, it's just very side effect heavy code that hard to use without the monolith architecture Kubo was built on. Maybe there is something better elsewhere but this seems like a complete refactor of the pinner which I don't want to take on right now. |
Yet that's what is actually happening. Consider those two examples (among other):
If you look at my
I'm only suggesting to eliminate As for bitswap, I'd like to ask you to do the exercise in reverse: why would Pinner need to write blocks? Why does it needs to fetch a DAG? I don't see better reason than "it was written that way in ancient ages because it was convenient". |
Additionally, |
Having worked on the Pinner in various way (including alternate implementation), it occurred to me that it really shouldn't be tasked to:
Pin()
: https://github.com/ipfs/go-ipfs-pinner/blob/72f5e02e73db5e05ef0a140a7938cbc89dfc38b0/dspinner/pin.go#L177Pin()
: https://github.com/ipfs/go-ipfs-pinner/blob/72f5e02e73db5e05ef0a140a7938cbc89dfc38b0/dspinner/pin.go#L202This is for different (not obvious, I admit) reasons:
Pin
andPinWithMode
and simplify the APIAdmittedly, things have worked that way for a long time, but fixing that might help in the long run. Looking at where
Pin
is called in kubo, it also looks like a non-invasive change.The text was updated successfully, but these errors were encountered: