Update to use new Builder interface for creating CIDs.#6
Merged
Conversation
This was referenced Aug 10, 2018
Stebalien
reviewed
Aug 10, 2018
node.go
Outdated
| } | ||
|
|
||
| // Prefix returns the CID Prefix for this ProtoNode, it is never nil | ||
| func (n *ProtoNode) Prefix() cid.Builder { |
Member
There was a problem hiding this comment.
If we're going to break this anyways, we might as well call this CidBuilder and SetCidBuilder. Any reason not to?
Contributor
Author
There was a problem hiding this comment.
No. I think I will just use Builder though.
raw.go
Outdated
| if prefix.Version == 0 { | ||
| prefix.Version = 1 | ||
| } | ||
| func NewRawNodeWPrefix(data []byte, prefix cid.Builder) (*RawNode, error) { |
Member
There was a problem hiding this comment.
Same. This is a breaking change (non-pointer Prefix doesn't implement cid.Builder, I think).
Contributor
Author
There was a problem hiding this comment.
non-pointer Prefix doesn't implement cid.Builder
Actually it does.
kevina
commented
Aug 11, 2018
| c, err := prefix.Sum(data) | ||
| // NewRawNodeWPrefix creates a RawNode using the provided cid builder | ||
| func NewRawNodeWPrefix(data []byte, builder cid.Builder) (*RawNode, error) { | ||
| builder = builder.WithCodec(cid.Raw) |
Contributor
Author
There was a problem hiding this comment.
Note: leaving this one alone for now. I personally think we should change NewRawNode to always take a builder rather than creating a separate function, it can take nil if the user wishes to use the default.
Stebalien
approved these changes
Aug 11, 2018
Jorropo
pushed a commit
to ipfs/boxo
that referenced
this pull request
Mar 15, 2023
Update to use new Builder interface for creating CIDs. This commit was moved from ipfs/go-merkledag@0244e50
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Depends on ipfs/go-cid#53.