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
374a75b6
Commit
374a75b6
authored
Jan 10, 2015
by
Juan Batiz-Benet
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refs: tie the contexts together
parent
322d6d0b
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
6 additions
and
3 deletions
+6
-3
blocks/blockstore/blockstore.go
blocks/blockstore/blockstore.go
+1
-0
core/commands/refs.go
core/commands/refs.go
+5
-3
No files found.
blocks/blockstore/blockstore.go
View file @
374a75b6
...
...
@@ -132,6 +132,7 @@ func (bs *blockstore) AllKeysChan(ctx context.Context, offset int, limit int) (<
// need to convert to u.Key using u.KeyFromDsKey.
k
=
u
.
KeyFromDsKey
(
ds
.
NewKey
(
e
.
Key
))
log
.
Debug
(
"blockstore: query got key"
,
k
)
return
k
,
true
}
}
...
...
core/commands/refs.go
View file @
374a75b6
...
...
@@ -54,6 +54,7 @@ Note: list all refs recursively with -r.
cmds
.
BoolOption
(
"recursive"
,
"r"
,
"Recursively list links of child nodes"
),
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
ctx
:=
req
.
Context
()
.
Context
n
,
err
:=
req
.
Context
()
.
GetNode
()
if
err
!=
nil
{
return
nil
,
err
...
...
@@ -93,7 +94,7 @@ Note: list all refs recursively with -r.
rw
:=
RefWriter
{
W
:
pipew
,
DAG
:
n
.
DAG
,
Ctx
:
n
.
Context
()
,
Ctx
:
ctx
,
Unique
:
unique
,
PrintEdge
:
edges
,
PrintFmt
:
format
,
...
...
@@ -122,13 +123,14 @@ Displays the hashes of all local objects.
},
Run
:
func
(
req
cmds
.
Request
)
(
interface
{},
error
)
{
ctx
:=
req
.
Context
()
.
Context
n
,
err
:=
req
.
Context
()
.
GetNode
()
if
err
!=
nil
{
return
nil
,
err
}
// todo: make async
allKeys
,
err
:=
n
.
Blockstore
.
AllKeys
(
context
.
TODO
()
,
0
,
0
)
allKeys
,
err
:=
n
.
Blockstore
.
AllKeys
Chan
(
ctx
,
0
,
0
)
if
err
!=
nil
{
return
nil
,
err
}
...
...
@@ -139,7 +141,7 @@ Displays the hashes of all local objects.
go
func
()
{
defer
pipew
.
Close
()
for
_
,
k
:=
range
allKeys
{
for
k
:=
range
allKeys
{
s
:=
k
.
Pretty
()
+
"
\n
"
if
_
,
err
:=
pipew
.
Write
([]
byte
(
s
));
err
!=
nil
{
log
.
Error
(
err
)
...
...
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