-
Notifications
You must be signed in to change notification settings - Fork 52
Conversation
ffb1fae
to
0899631
Compare
@schomatis, could u help me review it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great job! Could you do a quick check that this passes the go-ipfs tests? You'll need to run gx-go link go-unixfs
inside the go-ipfs
directory to make sure it's using your modified version.
unixfs.go
Outdated
@@ -182,6 +182,21 @@ func NewFSNode(dataType pb.Data_DataType) *FSNode { | |||
return n | |||
} | |||
|
|||
// Filesize gets filesize of format | |||
func (n *FSNode) Filesize() uint64 { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This function already exists below, it can be deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schomatis I had fixed it. Thx for your reply.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schomatis I am not sure whether we should delete FromBytes()
in this pr.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@schomatis I am not sure whether we should delete
FromBytes()
in this pr.
No, it's still used in many other repos, but we should probably add a "deprecated" sign or a note recommending the use of FSNodeFromBytes
.
0899631
to
978b7aa
Compare
978b7aa
to
8118a03
Compare
unixfs.go
Outdated
@@ -28,16 +28,6 @@ var ( | |||
ErrUnrecognizedType = errors.New("unrecognized node type") | |||
) | |||
|
|||
// FromBytes unmarshals a byte slice as protobuf Data. | |||
func FromBytes(data []byte) (*pb.Data, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, let's restore this function as mentioned above and add a deprecation notice:
// Deprecated: Use `FSNodeFromBytes` instead to avoid direct manipulation of `pb.Data.format`.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, I had added the Deprecated
description.
8118a03
to
8bea61e
Compare
fix(fsnode): issue ipfs#17 This commit was moved from ipfs/go-unixfs@f68092e
Fixes: ipfs/kubo#5217, #17