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

feat: update go-ipld-format and boxo to remove globals #296

Merged
merged 2 commits into from
Aug 10, 2023

Conversation

aschmahmann
Copy link
Contributor

No description provided.

go.mod Outdated Show resolved Hide resolved
Comment on lines -40 to -44
func init() {
ipld.Register(cid.DagProtobuf, merkledag.DecodeProtobufBlock)
ipld.Register(cid.Raw, merkledag.DecodeRawBlock)
ipld.Register(cid.DagCBOR, cbor.DecodeBlock) // need to decode CBOR
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

These appear unneeded, is there something I'm missing here?

Copy link
Owner

Choose a reason for hiding this comment

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

I'm relatively confident that without these you would do a ipfslite.DagService.Get() and the thing would error because it didn't know how to parse stuff (particularly with CBOR).

Perhaps this is no longer the case, perhaps these are preregistered somewhere else, I don't know. It was a way to not make the users go through the hassle of figuring out that they have to register the codecs they want to use.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So the merkledag library will still have a global registry for now ipfs/boxo#322 that will use the global go-ipld-prime registry + some overrides for dag-pb and raw which means the dagservice will be fine.

I don't think a breaking change to go-merkledag is in the cards for this round of PRs, but if you'd like the registry used by merkledag to be configurable I'm cool exposing it as a public global with sufficient warnings around it.

@codecov-commenter
Copy link

codecov-commenter commented Jun 6, 2023

Codecov Report

Patch coverage: 85.71% and project coverage change: -1.84 ⚠️

Comparison is base (7349efe) 71.35% compared to head (1e8fb0d) 69.51%.

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #296      +/-   ##
==========================================
- Coverage   71.35%   69.51%   -1.84%     
==========================================
  Files           2        2              
  Lines         199      187      -12     
==========================================
- Hits          142      130      -12     
  Misses         38       38              
  Partials       19       19              
Impacted Files Coverage Δ
ipfs.go 65.98% <85.71%> (-2.57%) ⬇️

☔ View full report in Codecov by Sentry.
📢 Do you have feedback about the report comment? Let us know in this issue.

@aschmahmann aschmahmann force-pushed the feat/remove-ipld-format-globals branch from 6d9d44f to 7ca89b4 Compare June 13, 2023 20:00
@aschmahmann aschmahmann marked this pull request as ready for review June 13, 2023 20:01
@aschmahmann aschmahmann force-pushed the feat/remove-ipld-format-globals branch from 7ca89b4 to 1e8fb0d Compare June 13, 2023 21:11
Comment on lines +170 to +182
p.reprovider = provider.NewNoopProvider()
return nil
}

queue, err := queue.NewQueue(p.ctx, "repro", p.store)
prov, err := provider.New(p.store,
provider.DatastorePrefix(datastore.NewKey("repro")),
provider.Online(p.dht),
provider.ReproviderInterval(p.cfg.ReprovideInterval),
provider.KeyProvider(provider.NewBlockstoreProvider(p.bstore)))
if err != nil {
return err
}
p.reprovider = prov
Copy link
Contributor Author

Choose a reason for hiding this comment

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

There were changes to the provider subsystem so this is what it should look like now

@aschmahmann
Copy link
Contributor Author

Waiting for review (and workflow running)

@hsanjuan hsanjuan merged commit a61fe73 into hsanjuan:master Aug 10, 2023
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.

3 participants