Commit 7737cb02 authored by Jeromy's avatar Jeromy

completely remove go-key dep

License: MIT
Signed-off-by: default avatarJeromy <why@ipfs.io>
parent 49c8ac01
...@@ -22,7 +22,6 @@ import ( ...@@ -22,7 +22,6 @@ import (
uio "github.com/ipfs/go-ipfs/unixfs/io" uio "github.com/ipfs/go-ipfs/unixfs/io"
node "gx/ipfs/QmUsVJ7AEnGyjX8YWnrwq9vmECVGwBQNAKPpgz5KSg8dcq/go-ipld-node" node "gx/ipfs/QmUsVJ7AEnGyjX8YWnrwq9vmECVGwBQNAKPpgz5KSg8dcq/go-ipld-node"
key "gx/ipfs/QmYEoKZXHoAToWfhGF3vryhMn3WWhE1o2MasQ8uzY5iDi9/go-key"
u "gx/ipfs/Qmb912gdngC1UWwTkhuW8knyRbcWeu5kqkxBpveLmW8bSr/go-ipfs-util" u "gx/ipfs/Qmb912gdngC1UWwTkhuW8knyRbcWeu5kqkxBpveLmW8bSr/go-ipfs-util"
cid "gx/ipfs/QmcEcrBAMrwMyhSjXt4yfyPpzgSuV8HLHavnfmiKCSRqZU/go-cid" cid "gx/ipfs/QmcEcrBAMrwMyhSjXt4yfyPpzgSuV8HLHavnfmiKCSRqZU/go-cid"
) )
...@@ -56,8 +55,8 @@ func TestNode(t *testing.T) { ...@@ -56,8 +55,8 @@ func TestNode(t *testing.T) {
} }
h := n.Multihash() h := n.Multihash()
k := n.Key() k := n.Cid().Hash()
if k != key.Key(h) { if k.String() != h.String() {
t.Error("Key is not equivalent to multihash") t.Error("Key is not equivalent to multihash")
} else { } else {
fmt.Println("key: ", k) fmt.Println("key: ", k)
...@@ -84,7 +83,7 @@ func SubtestNodeStat(t *testing.T, n *ProtoNode) { ...@@ -84,7 +83,7 @@ func SubtestNodeStat(t *testing.T, n *ProtoNode) {
return return
} }
k := n.Key() k := n.Cid()
expected := node.NodeStat{ expected := node.NodeStat{
NumLinks: len(n.Links()), NumLinks: len(n.Links()),
...@@ -92,7 +91,7 @@ func SubtestNodeStat(t *testing.T, n *ProtoNode) { ...@@ -92,7 +91,7 @@ func SubtestNodeStat(t *testing.T, n *ProtoNode) {
LinksSize: len(enc) - len(n.Data()), // includes framing. LinksSize: len(enc) - len(n.Data()), // includes framing.
DataSize: len(n.Data()), DataSize: len(n.Data()),
CumulativeSize: int(cumSize), CumulativeSize: int(cumSize),
Hash: k.B58String(), Hash: k.String(),
} }
actual, err := n.Stat() actual, err := n.Stat()
......
...@@ -6,7 +6,6 @@ import ( ...@@ -6,7 +6,6 @@ import (
node "gx/ipfs/QmUsVJ7AEnGyjX8YWnrwq9vmECVGwBQNAKPpgz5KSg8dcq/go-ipld-node" node "gx/ipfs/QmUsVJ7AEnGyjX8YWnrwq9vmECVGwBQNAKPpgz5KSg8dcq/go-ipld-node"
mh "gx/ipfs/QmYDds3421prZgqKbLpEK7T9Aa2eVdQ7o3YarX1LVLdP2J/go-multihash" mh "gx/ipfs/QmYDds3421prZgqKbLpEK7T9Aa2eVdQ7o3YarX1LVLdP2J/go-multihash"
key "gx/ipfs/QmYEoKZXHoAToWfhGF3vryhMn3WWhE1o2MasQ8uzY5iDi9/go-key"
cid "gx/ipfs/QmcEcrBAMrwMyhSjXt4yfyPpzgSuV8HLHavnfmiKCSRqZU/go-cid" cid "gx/ipfs/QmcEcrBAMrwMyhSjXt4yfyPpzgSuV8HLHavnfmiKCSRqZU/go-cid"
) )
...@@ -204,7 +203,7 @@ func (n *ProtoNode) Stat() (*node.NodeStat, error) { ...@@ -204,7 +203,7 @@ func (n *ProtoNode) Stat() (*node.NodeStat, error) {
} }
return &node.NodeStat{ return &node.NodeStat{
Hash: n.Key().B58String(), Hash: n.Cid().String(),
NumLinks: len(n.links), NumLinks: len(n.links),
BlockSize: len(enc), BlockSize: len(enc),
LinksSize: len(enc) - len(n.data), // includes framing. LinksSize: len(enc) - len(n.data), // includes framing.
...@@ -213,10 +212,6 @@ func (n *ProtoNode) Stat() (*node.NodeStat, error) { ...@@ -213,10 +212,6 @@ func (n *ProtoNode) Stat() (*node.NodeStat, error) {
}, nil }, nil
} }
func (n *ProtoNode) Key() key.Key {
return key.Key(n.Multihash())
}
func (n *ProtoNode) Loggable() map[string]interface{} { func (n *ProtoNode) Loggable() map[string]interface{} {
return map[string]interface{}{ return map[string]interface{}{
"node": n.String(), "node": n.String(),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment