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
0b481a3e
Commit
0b481a3e
authored
Jul 05, 2017
by
Jeromy Johnson
Committed by
GitHub
Jul 05, 2017
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #4022 from hermanjunge/feat/block-put-add-cid-codecs
Add CID Codecs to block put
parents
6ad24f61
f512a339
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
12 deletions
+7
-12
core/commands/block.go
core/commands/block.go
+7
-12
No files found.
core/commands/block.go
View file @
0b481a3e
...
...
@@ -9,10 +9,10 @@ import (
util
"github.com/ipfs/go-ipfs/blocks/blockstore/util"
cmds
"github.com/ipfs/go-ipfs/commands"
"gx/ipfs/QmXxGS5QsUxpR3iqL5DjmsYPHR1Yz74siRQ4ChJqWFosMh/go-block-format"
mh
"gx/ipfs/QmVGtdTZdTFaLsaj2RwdVG8jcjNNcp1DE914DKZ2kHmXHw/go-multihash"
u
"gx/ipfs/QmWbjfz3u6HkAdPh34dgPchGbQjob6LXLhAeCGii2TX69n/go-ipfs-util"
blocks
"gx/ipfs/QmXxGS5QsUxpR3iqL5DjmsYPHR1Yz74siRQ4ChJqWFosMh/go-block-format"
cid
"gx/ipfs/Qma4RJSuh7mMeJQYCqMbKzekn6EwBo7HEs5AQYjVRMQATB/go-cid"
)
...
...
@@ -149,20 +149,15 @@ It reads from stdin, and <key> is a base58 encoded multihash.
pref
.
Version
=
1
format
,
_
,
_
:=
req
.
Option
(
"format"
)
.
String
()
switch
format
{
case
"cbor"
:
pref
.
Codec
=
cid
.
DagCBOR
case
"protobuf"
:
pref
.
Codec
=
cid
.
DagProtobuf
case
"raw"
:
pref
.
Codec
=
cid
.
Raw
case
"v0"
:
pref
.
Version
=
0
pref
.
Codec
=
cid
.
DagProtobuf
default
:
formatval
,
ok
:=
cid
.
Codecs
[
format
]
if
!
ok
{
res
.
SetError
(
fmt
.
Errorf
(
"unrecognized format: %s"
,
format
),
cmds
.
ErrNormal
)
return
}
if
format
==
"v0"
{
pref
.
Version
=
0
}
pref
.
Codec
=
formatval
mhtype
,
_
,
_
:=
req
.
Option
(
"mhtype"
)
.
String
()
mhtval
,
ok
:=
mh
.
Names
[
mhtype
]
...
...
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