refactor(merkledag) move proto to internal pb package
https://docs.google.com/document/d/1e8kOo3r51b2BWtTs_1uADIA5djfXhPT36s6eHVRIvaU/edit
Brian Tiger Chow committed
Oct 22, 2014 at 04:15 UTC
1d08e1d7c23ea06bbc14ee5aea02d6d94b54c654
5 files changed
+8
-7
merkledag/coding.go
+8
-7
@@ -3,9 +3,10 @@ package merkledag
3
import (
4
"fmt"
5
6
- u "github.com/jbenet/go-ipfs/util"
7
-
6
mh "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-multihash"
7
+
8
+ pb "github.com/jbenet/go-ipfs/merkledag/internal/pb"
9
+ u "github.com/jbenet/go-ipfs/util"
10
)
11
12
// for now, we use a PBNode intermediate thing.
@@ -14,7 +15,7 @@ import (
15
// Unmarshal decodes raw data into a *Node instance.
16
// The conversion uses an intermediate PBNode.
17
func (n *Node) Unmarshal(encoded []byte) error {
17
- var pbn PBNode
18
+ var pbn pb.PBNode
19
if err := pbn.Unmarshal(encoded); err != nil {
20
return fmt.Errorf("Unmarshal failed. %v", err)
21
}
@@ -55,11 +56,11 @@ func (n *Node) Marshal() ([]byte, error) {
56
return data, nil
57
}
58
58
-func (n *Node) getPBNode() *PBNode {
59
- pbn := &PBNode{}
60
- pbn.Links = make([]*PBLink, len(n.Links))
59
+func (n *Node) getPBNode() *pb.PBNode {
60
+ pbn := &pb.PBNode{}
61
+ pbn.Links = make([]*pb.PBLink, len(n.Links))
62
for i, l := range n.Links {
62
- pbn.Links[i] = &PBLink{}
63
+ pbn.Links[i] = &pb.PBLink{}
64
pbn.Links[i].Name = &l.Name
65
pbn.Links[i].Tsize = &l.Size
66
pbn.Links[i].Hash = []byte(l.Hash)