Skip to content
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

provider: provide MFS DAG using offline fetcher. #10754

Open
wants to merge 7 commits into
base: master
Choose a base branch
from

Conversation

hsanjuan
Copy link
Contributor

Fixes #10386. Overseeds #10704.

This augments the current provider KeyChanFuncs with the CIDs coming from the MFS DAG. MFS CIDs are listed using the offline fetcher, which has been updated with SkipNotFound so that no errors happen during traversal when nodes are missing.

Strategies have been updated:

  • For "roots" and "all" strategy we announce the MFS root only, after the pins.
  • For the "pinned" strategy, we announce the MFS Cids after the pin cids.
  • A new "mfs" strategy is added, only for MFS cids.

The code around strategy selection has been slightly change for the better (I hope).

Fixes #10386. Overseeds #10704.

This augments the current provider KeyChanFuncs with the CIDs coming from the MFS DAG. MFS CIDs
are listed using the offline fetcher, which has been updated with SkipNotFound so that no
errors happen during traversal when nodes are missing.

Strategies have been updated:

- For "roots" and "all" strategy we announce the MFS root only, after the
pins.
- For the "pinned" strategy, we announce the MFS Cids after the pin cids.
- A new "mfs" strategy is added, only for MFS cids.

The code around strategy selection has been slightly change for the better (I
hope).
case "pinned":
return provider.NewPrioritizedProvider(
provider.NewBufferedProvider(provider.NewPinnedProvider(false, in.Pinner, in.IPLDFetcher)),
mfsProvider(in.MFSRoot, in.OfflineUnixFSFetcher),
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The downside here is that there is no strategy that only provide "recursive-pinned" content, and no mfs.

If we don't provide mfs here, there will be no policy that provides only "recursive-pinned+mfs" content... but it could be added as pinned+mfs or so...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MFS is implicitly pinned (protected from GC) so I think it is fine to keep it under pinned.
But things get hairy with roots (we dont have ability to only announce dir and file roots as we walk MFS, right?).

Maybe keeping pinned and roots as-is, and adding separate pinned+mfs for now is the right way of handling this? (we dont change behavior for existing users, and new users can choose pinned+mfs).

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a problem to only announce the MFS-root? (consider it a big file)... Or you mean this could cause misunderstandings?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in the meantime I restored "pinned" and "roots" and added "pinned+mfs"

Copy link
Member

@lidel lidel Mar 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm thinking:

  • if you pin something then that pin is usually recursive
    • pinned announces recursive pins by walking the entire DAG behind each recursively pinned CID
    • roots announces only root cids of pins (no DAG walk at all)
  • pinned+mfs should do the same as pinned – walk the MFS DAG and announce MFS recursively (only local blocks).
  • roots
    • easy: could also announce only MFS root (no need to create roots+mfs just for one CID, fine to announce MFS root with other pin roots)
    • harder: make MFS walk smart enough to only yield root CIDs of files and directories (imo this comes with extra overhead, and no longer can be roots and requires separate profile roots+mfs)

I think its fine to do "easy" roots for now – announce the MFS root for now (without walking dag and discovering sub-entity roots).
We can add roots+mfs if users ask for it.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could also announce only MFS root (no need to create roots+mfs just for one CID, fine to announce MFS root with other pin roots)

This is how it was.

@hsanjuan hsanjuan marked this pull request as ready for review March 17, 2025 10:54
@hsanjuan hsanjuan requested a review from a team as a code owner March 17, 2025 10:54
@hsanjuan hsanjuan requested a review from lidel March 17, 2025 10:54
This was referenced Mar 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Include local MFS entity roots in Reprovider.Strategy=roots|pinned
2 participants