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
580584a9
Commit
580584a9
authored
Nov 14, 2016
by
Jeromy Johnson
Committed by
GitHub
Nov 14, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #3379 from ipfs/kevina/blockstore-nonewkey
blockstore: fix TODO and avoid calling ds.NewKey
parents
10915f34
d48d9044
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
1 deletion
+9
-1
blocks/blockstore/blockstore.go
blocks/blockstore/blockstore.go
+1
-1
thirdparty/ds-help/key.go
thirdparty/ds-help/key.go
+8
-0
No files found.
blocks/blockstore/blockstore.go
View file @
580584a9
...
...
@@ -196,7 +196,7 @@ func (bs *blockstore) AllKeysChan(ctx context.Context) (<-chan *cid.Cid, error)
}
// need to convert to key.Key using key.KeyFromDsKey.
c
,
err
:=
dshelp
.
DsKey
ToCid
(
ds
.
NewKey
(
e
.
Key
))
// TODO: calling NewKey isnt free
c
,
err
:=
dshelp
.
DsKey
StringToCid
(
e
.
Key
)
if
err
!=
nil
{
log
.
Warningf
(
"error parsing key from DsKey: "
,
err
)
return
nil
,
true
...
...
thirdparty/ds-help/key.go
View file @
580584a9
...
...
@@ -26,3 +26,11 @@ func DsKeyToCid(dsKey ds.Key) (*cid.Cid, error) {
}
return
cid
.
Cast
(
kb
)
}
func
DsKeyStringToCid
(
dsKey
string
)
(
*
cid
.
Cid
,
error
)
{
kb
,
err
:=
base32
.
RawStdEncoding
.
DecodeString
(
dsKey
[
1
:
])
if
err
!=
nil
{
return
nil
,
err
}
return
cid
.
Cast
(
kb
)
}
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