Commit b783f032 authored by Jeromy's avatar Jeromy

Implement cbor ipld nodes and a first pass at the 'dag' command

License: MIT
Signed-off-by: default avatarJeromy <why@ipfs.io>
parent ff1df7aa
...@@ -14,6 +14,7 @@ import ( ...@@ -14,6 +14,7 @@ import (
logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log" logging "gx/ipfs/QmSpJByNKFX1sCsHBEp3R73FL4NF6FnQTEGyNAXHm2GS52/go-log"
node "gx/ipfs/QmU7bFWQ793qmvNy7outdCaMfSDNk8uqhx4VNrxYj5fj5g/go-ipld-node" node "gx/ipfs/QmU7bFWQ793qmvNy7outdCaMfSDNk8uqhx4VNrxYj5fj5g/go-ipld-node"
cid "gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBddsvEP4RPfXb6nGqY/go-cid" cid "gx/ipfs/QmXfiyr2RWEXpVDdaYnD2HNiBk6UBddsvEP4RPfXb6nGqY/go-cid"
ipldcbor "gx/ipfs/QmYRzW9YDHVNCDbfFzbS7TEXAG1swE1yjq1basZ5WnJYH4/go-ipld-cbor"
) )
var log = logging.Logger("merkledag") var log = logging.Logger("merkledag")
...@@ -105,6 +106,12 @@ func decodeBlock(b blocks.Block) (node.Node, error) { ...@@ -105,6 +106,12 @@ func decodeBlock(b blocks.Block) (node.Node, error) {
return decnd, nil return decnd, nil
case cid.Raw: case cid.Raw:
return NewRawNode(b.RawData()), nil return NewRawNode(b.RawData()), nil
case cid.CBOR:
return ipldcbor.Decode(b.RawData())
/*
case cid.Bitcoin:
return ipldbtc.DecodeBlock(b.RawData())
*/
default: default:
return nil, fmt.Errorf("unrecognized object type: %s", c.Type()) return nil, fmt.Errorf("unrecognized object type: %s", c.Type())
} }
......
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