Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
4373bf9d
提交
4373bf9d
authored
12月 13, 2016
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
merkledag: fix json marshalling of pbnode
License: MIT Signed-off-by:
Jeromy
<
why@ipfs.io
>
上级
4cb236ca
隐藏空白字符变更
内嵌
并排
正在显示
2 个修改的文件
包含
23 行增加
和
0 行删除
+23
-0
node.go
merkledag/node.go
+10
-0
t0053-dag.sh
test/sharness/t0053-dag.sh
+13
-0
没有找到文件。
merkledag/node.go
浏览文件 @
4373bf9d
...
@@ -2,6 +2,7 @@ package merkledag
...
@@ -2,6 +2,7 @@ package merkledag
import
(
import
(
"context"
"context"
"encoding/json"
"fmt"
"fmt"
node
"gx/ipfs/QmRSU5EqqWVZSNdbU51yXmVoF1uNw3JgTNB6RaiL7DZM16/go-ipld-node"
node
"gx/ipfs/QmRSU5EqqWVZSNdbU51yXmVoF1uNw3JgTNB6RaiL7DZM16/go-ipld-node"
...
@@ -228,6 +229,15 @@ func (n *ProtoNode) Loggable() map[string]interface{} {
...
@@ -228,6 +229,15 @@ func (n *ProtoNode) Loggable() map[string]interface{} {
}
}
}
}
func
(
n
*
ProtoNode
)
MarshalJSON
()
([]
byte
,
error
)
{
out
:=
map
[
string
]
interface
{}{
"data"
:
n
.
data
,
"links"
:
n
.
links
,
}
return
json
.
Marshal
(
out
)
}
func
(
n
*
ProtoNode
)
Cid
()
*
cid
.
Cid
{
func
(
n
*
ProtoNode
)
Cid
()
*
cid
.
Cid
{
if
n
.
encoded
!=
nil
&&
n
.
cached
!=
nil
{
if
n
.
encoded
!=
nil
&&
n
.
cached
!=
nil
{
return
n
.
cached
return
n
.
cached
...
...
test/sharness/t0053-dag.sh
浏览文件 @
4373bf9d
...
@@ -46,6 +46,19 @@ test_dag_cmd() {
...
@@ -46,6 +46,19 @@ test_dag_cmd() {
test_cmp file2 out2 &&
test_cmp file2 out2 &&
test_cmp file3 out3
test_cmp file3 out3
'
'
test_expect_success
"add a normal file"
'
HASH=$(echo "foobar" | ipfs add -q)
'
test_expect_success
"can view protobuf object with dag get"
'
ipfs dag get $HASH > dag_get_pb_out
'
test_expect_success
"output looks correct"
'
echo "{\"data\":\"CAISB2Zvb2JhcgoYBw==\",\"links\":[]}" > dag_get_pb_exp &&
test_cmp dag_get_pb_exp dag_get_pb_out
'
}
}
# should work offline
# should work offline
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论