Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
206739d1
提交
206739d1
authored
9月 04, 2015
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
allow channel marshaler to return errors from cmds.Response
License: MIT Signed-off-by:
Jeromy
<
jeromyj@gmail.com
>
上级
93e9f841
隐藏空白字符变更
内嵌
并排
正在显示
7 个修改的文件
包含
15 行增加
和
0 行删除
+15
-0
channelmarshaler.go
commands/channelmarshaler.go
+5
-0
response.go
commands/response.go
+1
-0
dht.go
core/commands/dht.go
+5
-0
ping.go
core/commands/ping.go
+1
-0
refs.go
core/commands/refs.go
+1
-0
repo.go
core/commands/repo.go
+1
-0
stat.go
core/commands/stat.go
+1
-0
没有找到文件。
commands/channelmarshaler.go
浏览文件 @
206739d1
...
...
@@ -5,6 +5,7 @@ import "io"
type
ChannelMarshaler
struct
{
Channel
<-
chan
interface
{}
Marshaler
func
(
interface
{})
(
io
.
Reader
,
error
)
Res
Response
reader
io
.
Reader
}
...
...
@@ -13,6 +14,10 @@ func (cr *ChannelMarshaler) Read(p []byte) (int, error) {
if
cr
.
reader
==
nil
{
val
,
more
:=
<-
cr
.
Channel
if
!
more
{
//check error in response
if
cr
.
Res
.
Error
()
!=
nil
{
return
0
,
cr
.
Res
.
Error
()
}
return
0
,
io
.
EOF
}
...
...
commands/response.go
浏览文件 @
206739d1
...
...
@@ -57,6 +57,7 @@ var marshallers = map[EncodingType]Marshaler{
return
&
ChannelMarshaler
{
Channel
:
ch
,
Marshaler
:
marshalJson
,
Res
:
res
,
},
nil
}
...
...
core/commands/dht.go
浏览文件 @
206739d1
...
...
@@ -131,6 +131,7 @@ var queryDhtCmd = &cmds.Command{
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
@@ -249,6 +250,7 @@ FindProviders will return a list of peers who are able to provide the value requ
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
@@ -354,6 +356,7 @@ var findPeerDhtCmd = &cmds.Command{
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
@@ -461,6 +464,7 @@ GetValue will return the value stored in the dht at the given key.
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
@@ -571,6 +575,7 @@ PutValue will store the given key value pair in the dht.
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
core/commands/ping.go
浏览文件 @
206739d1
...
...
@@ -71,6 +71,7 @@ trip latency information.
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
core/commands/refs.go
浏览文件 @
206739d1
...
...
@@ -141,6 +141,7 @@ Note: list all refs recursively with -r.
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
core/commands/repo.go
浏览文件 @
206739d1
...
...
@@ -90,6 +90,7 @@ order to reclaim hard disk space.
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outChan
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
core/commands/stat.go
浏览文件 @
206739d1
...
...
@@ -167,6 +167,7 @@ var statBwCmd = &cmds.Command{
return
&
cmds
.
ChannelMarshaler
{
Channel
:
outCh
,
Marshaler
:
marshal
,
Res
:
res
,
},
nil
},
},
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论