Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-unixfs
Commits
033e33da
Commit
033e33da
authored
Jan 10, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(core): expose IpfsNode.Resolve
parent
223ee4df
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
7 additions
and
4 deletions
+7
-4
core/core.go
core/core.go
+5
-0
core/io/cat.go
core/io/cat.go
+2
-4
No files found.
core/core.go
View file @
033e33da
...
...
@@ -29,6 +29,7 @@ import (
pin
"github.com/jbenet/go-ipfs/pin"
routing
"github.com/jbenet/go-ipfs/routing"
dht
"github.com/jbenet/go-ipfs/routing/dht"
util
"github.com/jbenet/go-ipfs/util"
ds2
"github.com/jbenet/go-ipfs/util/datastore2"
debugerror
"github.com/jbenet/go-ipfs/util/debugerror"
eventlog
"github.com/jbenet/go-ipfs/util/eventlog"
...
...
@@ -264,6 +265,10 @@ func (n *IpfsNode) OnlineMode() bool {
}
}
func
(
n
*
IpfsNode
)
Resolve
(
k
util
.
Key
)
(
*
merkledag
.
Node
,
error
)
{
return
(
&
path
.
Resolver
{
n
.
DAG
})
.
ResolvePath
(
k
.
String
())
}
func
(
n
*
IpfsNode
)
Bootstrap
(
ctx
context
.
Context
,
peers
[]
peer
.
PeerInfo
)
error
{
if
n
.
DHT
!=
nil
{
for
_
,
p
:=
range
peers
{
...
...
core/io/cat.go
View file @
033e33da
...
...
@@ -15,16 +15,14 @@ import (
"io"
core
"github.com/jbenet/go-ipfs/core"
path
"github.com/jbenet/go-ipfs/path"
uio
"github.com/jbenet/go-ipfs/unixfs/io"
u
"github.com/jbenet/go-ipfs/util"
)
func
Cat
(
n
*
core
.
IpfsNode
,
k
u
.
Key
)
(
io
.
Reader
,
error
)
{
dag
:=
n
.
DAG
dagNode
,
err
:=
(
&
path
.
Resolver
{
dag
})
.
ResolvePath
(
k
.
String
())
dagNode
,
err
:=
n
.
Resolve
(
k
)
if
err
!=
nil
{
return
nil
,
err
}
return
uio
.
NewDagReader
(
dagNode
,
dag
)
return
uio
.
NewDagReader
(
dagNode
,
n
.
DAG
)
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment