Skip to content

Conversation

aschmahmann
Copy link
Collaborator

@aschmahmann aschmahmann commented Jun 5, 2023

This is related to ipfs/boxo#291 and depends on ipfs/go-ds-crdt#201 and hsanjuan/ipfs-lite#296

go.mod Outdated
Comment on lines 20 to 33
github.com/ipfs/boxo v0.8.2-0.20230602131956-922a186d9cef
github.com/ipfs/go-block-format v0.1.2
github.com/ipfs/go-cid v0.4.0
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ds-badger v0.3.0
github.com/ipfs/go-ds-badger3 v0.0.2
github.com/ipfs/go-ds-crdt v0.4.0
github.com/ipfs/go-ds-crdt v0.4.1-0.20230605203104-b879ef19ed1e
github.com/ipfs/go-ds-leveldb v0.5.0
github.com/ipfs/go-ds-pebble v0.2.3
github.com/ipfs/go-fs-lock v0.0.7
github.com/ipfs/go-ipfs-api v0.6.0
github.com/ipfs/go-ipfs-cmds v0.9.0
github.com/ipfs/go-ipld-cbor v0.0.6
github.com/ipfs/go-ipld-format v0.4.0
github.com/ipfs/go-ipld-format v0.4.1-0.20230530195241-c3da01c74a06
Copy link
Collaborator Author

@aschmahmann aschmahmann Jun 5, 2023

Choose a reason for hiding this comment

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

TODO: use released of go-ds-crdt and ipfs-lite once those PRs are merged.

@aschmahmann aschmahmann force-pushed the feat/remove-ipld-format-globals branch from f136f3a to 96df5ae Compare June 5, 2023 20:43
Comment on lines +36 to +48
var ipldDecoder *ipldlegacy.Decoder

// create an ipld registry specific to this package
func init() {
ipld.Register(cid.DagProtobuf, merkledag.DecodeProtobufBlock)
ipld.Register(cid.Raw, merkledag.DecodeRawBlock)
ipld.Register(cid.DagCBOR, cbor.DecodeBlock)
mcReg := multicodec.Registry{}
mcReg.RegisterDecoder(cid.DagProtobuf, dagpb.Decode)
mcReg.RegisterDecoder(cid.Raw, raw.Decode)
mcReg.RegisterDecoder(cid.DagCBOR, dagcbor.Decode)
ls := cidlink.LinkSystemUsingMulticodecRegistry(mcReg)

ipldDecoder = ipldlegacy.NewDecoderWithLS(ls)
ipldDecoder.RegisterCodec(cid.DagProtobuf, dagpb.Type.PBNode, merkledag.ProtoNodeConverter)
ipldDecoder.RegisterCodec(cid.Raw, basicnode.Prototype.Bytes, merkledag.RawNodeConverter)
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Needs a decision on the type of registry to use here:

  • go-ipld-prime codecs with wrappers for dag-pb + raw ( e.g. the initial proposal here )
  • go-ipld-prime globals (e.g. including other codecs) with dag-pb + raw wrappers
  • go-ipld-format only registry

cc @hsanjuan

Copy link
Collaborator

Choose a reason for hiding this comment

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

What do you recommend?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I'm not sure how the performance of the codecs compares (e.g. the two dag-cbor codecs). I feel like I've heard both are better from different parties.

I'd stay away from global variables though, since less magic makes it more obvious what you do/don't support.


Whether you go with the go-ipld-format codecs and then add go-ipld-legacy wrappers for go-ipld-prime codecs, or use go-ipld-prime codecs with the couple necessary wrappers for dag-pb/raw doesn't make a big difference. I've heard people say the old codecs are faster, and I've heard the inverse too. Haven't had the motivation to benchmark and see though 🤷.

Copy link
Collaborator

Choose a reason for hiding this comment

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

I guess we can take what you did here then 🤷

@aschmahmann aschmahmann force-pushed the feat/remove-ipld-format-globals branch from 96df5ae to 4128ab6 Compare June 13, 2023 21:23
@aschmahmann aschmahmann marked this pull request as ready for review June 14, 2023 21:26
@hsanjuan
Copy link
Collaborator

Including this in a separate PR with general dependency upgrades.

@hsanjuan hsanjuan closed this 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.

2 participants