1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-17 16:37:59 +08:00

merkledag: change 'Node' to be an interface

Also change existing 'Node' type to 'ProtoNode' and use that most
everywhere for now. As we move forward with the integration we will try
and use the Node interface in more places that we're currently using
ProtoNode.

License: MIT
Signed-off-by: Jeromy <why@ipfs.io>
This commit is contained in:
Jeromy
2016-10-09 12:59:36 -07:00
parent 015d476c4f
commit 01aee44679
61 changed files with 852 additions and 523 deletions

View File

@ -7,6 +7,7 @@ import (
cmds "github.com/ipfs/go-ipfs/commands"
core "github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/core/coreunix"
dag "github.com/ipfs/go-ipfs/merkledag"
path "github.com/ipfs/go-ipfs/path"
tar "github.com/ipfs/go-ipfs/tar"
)
@ -100,7 +101,13 @@ var tarCatCmd = &cmds.Command{
return
}
r, err := tar.ExportTar(req.Context(), root, nd.DAG)
rootpb, ok := root.(*dag.ProtoNode)
if !ok {
res.SetError(dag.ErrNotProtobuf, cmds.ErrNormal)
return
}
r, err := tar.ExportTar(req.Context(), rootpb, nd.DAG)
if err != nil {
res.SetError(err, cmds.ErrNormal)
return