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-dms3
Commits
b415e061
Commit
b415e061
authored
Oct 08, 2015
by
Juan Benet
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #1797 from rht/fix/cat
Add context to coreunix.Cat argument
parents
bb8e231b
6ae0973e
Changes
8
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
11 additions
and
10 deletions
+11
-10
core/commands/cat.go
core/commands/cat.go
+1
-1
core/coreunix/cat.go
core/coreunix/cat.go
+4
-3
fuse/readonly/ipfs_test.go
fuse/readonly/ipfs_test.go
+1
-1
test/integration/addcat_test.go
test/integration/addcat_test.go
+1
-1
test/integration/bench_cat_test.go
test/integration/bench_cat_test.go
+1
-1
test/integration/grandcentral_test.go
test/integration/grandcentral_test.go
+1
-1
test/integration/three_legged_cat_test.go
test/integration/three_legged_cat_test.go
+1
-1
test/supernode_client/main.go
test/supernode_client/main.go
+1
-1
No files found.
core/commands/cat.go
View file @
b415e061
...
...
@@ -67,7 +67,7 @@ func cat(ctx context.Context, node *core.IpfsNode, paths []string) ([]io.Reader,
readers
:=
make
([]
io
.
Reader
,
0
,
len
(
paths
))
length
:=
uint64
(
0
)
for
_
,
fpath
:=
range
paths
{
read
,
err
:=
coreunix
.
Cat
(
node
,
fpath
)
read
,
err
:=
coreunix
.
Cat
(
ctx
,
node
,
fpath
)
if
err
!=
nil
{
return
nil
,
0
,
err
}
...
...
core/coreunix/cat.go
View file @
b415e061
package
coreunix
import
(
context
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
core
"github.com/ipfs/go-ipfs/core"
path
"github.com/ipfs/go-ipfs/path"
uio
"github.com/ipfs/go-ipfs/unixfs/io"
)
func
Cat
(
n
*
core
.
IpfsNode
,
pstr
string
)
(
*
uio
.
DagReader
,
error
)
{
func
Cat
(
ctx
context
.
Context
,
n
*
core
.
IpfsNode
,
pstr
string
)
(
*
uio
.
DagReader
,
error
)
{
p
:=
path
.
FromString
(
pstr
)
dagNode
,
err
:=
n
.
Resolver
.
ResolvePath
(
n
.
Context
()
,
p
)
dagNode
,
err
:=
n
.
Resolver
.
ResolvePath
(
ctx
,
p
)
if
err
!=
nil
{
return
nil
,
err
}
return
uio
.
NewDagReader
(
n
.
Context
()
,
dagNode
,
n
.
DAG
)
return
uio
.
NewDagReader
(
ctx
,
dagNode
,
n
.
DAG
)
}
fuse/readonly/ipfs_test.go
View file @
b415e061
...
...
@@ -168,7 +168,7 @@ func TestIpfsStressRead(t *testing.T) {
t
.
Fatal
(
err
)
}
read
,
err
:=
coreunix
.
Cat
(
nd
,
item
)
read
,
err
:=
coreunix
.
Cat
(
nd
.
Context
(),
nd
,
item
)
if
err
!=
nil
{
t
.
Fatal
(
err
)
}
...
...
test/integration/addcat_test.go
View file @
b415e061
...
...
@@ -138,7 +138,7 @@ func DirectAddCat(data []byte, conf testutil.LatencyConfig) error {
return
err
}
readerCatted
,
err
:=
coreunix
.
Cat
(
catter
,
added
)
readerCatted
,
err
:=
coreunix
.
Cat
(
ctx
,
catter
,
added
)
if
err
!=
nil
{
return
err
}
...
...
test/integration/bench_cat_test.go
View file @
b415e061
...
...
@@ -84,7 +84,7 @@ func benchCat(b *testing.B, data []byte, conf testutil.LatencyConfig) error {
}
b
.
StartTimer
()
readerCatted
,
err
:=
coreunix
.
Cat
(
catter
,
added
)
readerCatted
,
err
:=
coreunix
.
Cat
(
ctx
,
catter
,
added
)
if
err
!=
nil
{
return
err
}
...
...
test/integration/grandcentral_test.go
View file @
b415e061
...
...
@@ -62,7 +62,7 @@ func RunSupernodeBootstrappedAddCat(data []byte, conf testutil.LatencyConfig) er
return
err
}
readerCatted
,
err
:=
coreunix
.
Cat
(
catter
,
keyAdded
)
readerCatted
,
err
:=
coreunix
.
Cat
(
ctx
,
catter
,
keyAdded
)
if
err
!=
nil
{
return
err
}
...
...
test/integration/three_legged_cat_test.go
View file @
b415e061
...
...
@@ -117,7 +117,7 @@ func RunThreeLeggedCat(data []byte, conf testutil.LatencyConfig) error {
return
err
}
readerCatted
,
err
:=
coreunix
.
Cat
(
catter
,
added
)
readerCatted
,
err
:=
coreunix
.
Cat
(
ctx
,
catter
,
added
)
if
err
!=
nil
{
return
err
}
...
...
test/supernode_client/main.go
View file @
b415e061
...
...
@@ -199,7 +199,7 @@ func runFileCattingWorker(ctx context.Context, n *core.IpfsNode) error {
"localPeer"
:
n
.
Identity
,
}
}))
if
r
,
err
:=
coreunix
.
Cat
(
n
,
k
);
err
!=
nil
{
if
r
,
err
:=
coreunix
.
Cat
(
ctx
,
n
,
k
);
err
!=
nil
{
e
.
Done
()
log
.
Printf
(
"failed to cat file. seed: %d #%d key: %s err: %s"
,
*
seed
,
i
,
k
,
err
)
}
else
{
...
...
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