1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 17:22:21 +08:00

integrate bitswap and blockservice into the core package

This commit is contained in:
Jeromy
2014-08-29 11:34:50 -07:00
parent fcff5a5c96
commit 691d1b36bb
8 changed files with 68 additions and 12 deletions

View File

@ -2,11 +2,12 @@ package path
import (
"fmt"
"path"
"strings"
merkledag "github.com/jbenet/go-ipfs/merkledag"
u "github.com/jbenet/go-ipfs/util"
mh "github.com/jbenet/go-multihash"
"path"
"strings"
)
// Resolver provides path resolution to IPFS
@ -19,6 +20,7 @@ type Resolver struct {
// path component as a hash (key) of the first node, then resolves
// all other components walking the links, with ResolveLinks.
func (s *Resolver) ResolvePath(fpath string) (*merkledag.Node, error) {
u.DOut("Resolve: '%s'\n", fpath)
fpath = path.Clean(fpath)
parts := strings.Split(fpath, "/")
@ -39,6 +41,7 @@ func (s *Resolver) ResolvePath(fpath string) (*merkledag.Node, error) {
return nil, err
}
u.DOut("Resolve dag get.\n")
nd, err := s.DAG.Get(u.Key(h))
if err != nil {
return nil, err