Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
559a2415
提交
559a2415
authored
2月 02, 2015
作者:
Jeromy
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
implement a simple wantlist command to allow the user to view their wantlist
上级
5d7a3dfe
隐藏空白字符变更
内嵌
并排
正在显示
5 个修改的文件
包含
50 行增加
和
0 行删除
+50
-0
root.go
core/commands/root.go
+1
-0
wantlist.go
core/commands/wantlist.go
+34
-0
bitswap.go
exchange/bitswap/bitswap.go
+8
-0
interface.go
exchange/interface.go
+2
-0
offline.go
exchange/offline/offline.go
+5
-0
没有找到文件。
core/commands/root.go
浏览文件 @
559a2415
...
...
@@ -98,6 +98,7 @@ var rootSubcommands = map[string]*cmds.Command{
"swarm"
:
SwarmCmd
,
"update"
:
UpdateCmd
,
"version"
:
VersionCmd
,
"wantlist"
:
WantlistCmd
,
}
func
init
()
{
...
...
core/commands/wantlist.go
0 → 100644
浏览文件 @
559a2415
package
commands
import
cmds
"github.com/jbenet/go-ipfs/commands"
var
WantlistCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"A set of commands to work with the bitswap wantlist"
,
ShortDescription
:
``
,
},
Subcommands
:
map
[
string
]
*
cmds
.
Command
{
"show"
:
showWantlistCmd
,
},
}
var
showWantlistCmd
=
&
cmds
.
Command
{
Helptext
:
cmds
.
HelpText
{
Tagline
:
"Show blocks currently on the wantlist"
,
ShortDescription
:
`
Print out all blocks currently on the bitswap wantlist for the local peer`
,
},
Type
:
KeyList
{},
Run
:
func
(
req
cmds
.
Request
,
res
cmds
.
Response
)
{
nd
,
err
:=
req
.
Context
()
.
GetNode
()
if
err
!=
nil
{
res
.
SetError
(
err
,
cmds
.
ErrNormal
)
return
}
res
.
SetOutput
(
&
KeyList
{
nd
.
Exchange
.
GetWantlist
()})
},
Marshalers
:
cmds
.
MarshalerMap
{
cmds
.
Text
:
KeyListTextMarshaler
,
},
}
exchange/bitswap/bitswap.go
浏览文件 @
559a2415
...
...
@@ -402,3 +402,11 @@ func (bs *bitswap) send(ctx context.Context, p peer.ID, m bsmsg.BitSwapMessage)
func
(
bs
*
bitswap
)
Close
()
error
{
return
bs
.
process
.
Close
()
}
func
(
bs
*
bitswap
)
GetWantlist
()
[]
u
.
Key
{
var
out
[]
u
.
Key
for
_
,
e
:=
range
bs
.
wantlist
.
Entries
()
{
out
=
append
(
out
,
e
.
Key
)
}
return
out
}
exchange/interface.go
浏览文件 @
559a2415
...
...
@@ -21,5 +21,7 @@ type Interface interface {
// available on the network?
HasBlock
(
context
.
Context
,
*
blocks
.
Block
)
error
GetWantlist
()
[]
u
.
Key
io
.
Closer
}
exchange/offline/offline.go
浏览文件 @
559a2415
...
...
@@ -66,3 +66,8 @@ func (e *offlineExchange) GetBlocks(ctx context.Context, ks []u.Key) (<-chan *bl
}()
return
out
,
nil
}
// implement Exchange
func
(
e
*
offlineExchange
)
GetWantlist
()
[]
u
.
Key
{
return
nil
}
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论