Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
80370f06
提交
80370f06
authored
5月 16, 2018
作者:
Brendan McMillion
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Remove leftover bits of code.
License: MIT Signed-off-by:
Brendan McMillion
<
brendan@cloudflare.com
>
上级
b3faaad1
隐藏空白字符变更
内嵌
并排
正在显示
4 个修改的文件
包含
10 行增加
和
43 行删除
+10
-43
daemon.go
cmd/ipfs/daemon.go
+0
-4
ipfs.go
cmd/ipfs/ipfs.go
+0
-5
main.go
cmd/ipfs/main.go
+8
-21
core.go
core/core.go
+2
-13
没有找到文件。
cmd/ipfs/daemon.go
浏览文件 @
80370f06
...
@@ -301,10 +301,6 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
...
@@ -301,10 +301,6 @@ func daemonFunc(req *cmds.Request, re cmds.ResponseEmitter, env cmds.Environment
}
}
routingOption
,
_
:=
req
.
Options
[
routingOptionKwd
]
.
(
string
)
routingOption
,
_
:=
req
.
Options
[
routingOptionKwd
]
.
(
string
)
if
err
!=
nil
{
re
.
SetError
(
err
,
cmdkit
.
ErrNormal
)
return
}
if
routingOption
==
routingOptionDefaultKwd
{
if
routingOption
==
routingOptionDefaultKwd
{
cfg
,
err
:=
repo
.
Config
()
cfg
,
err
:=
repo
.
Config
()
if
err
!=
nil
{
if
err
!=
nil
{
...
...
cmd/ipfs/ipfs.go
浏览文件 @
80370f06
...
@@ -26,7 +26,6 @@ var localCommands = map[string]*cmds.Command{
...
@@ -26,7 +26,6 @@ var localCommands = map[string]*cmds.Command{
"init"
:
initCmd
,
"init"
:
initCmd
,
"commands"
:
commandsClientCmd
,
"commands"
:
commandsClientCmd
,
}
}
var
localMap
=
make
(
map
[
*
cmds
.
Command
]
bool
)
func
init
()
{
func
init
()
{
// setting here instead of in literal to prevent initialization loop
// setting here instead of in literal to prevent initialization loop
...
@@ -38,10 +37,6 @@ func init() {
...
@@ -38,10 +37,6 @@ func init() {
Root
.
Subcommands
[
k
]
=
v
Root
.
Subcommands
[
k
]
=
v
}
}
}
}
for
_
,
v
:=
range
localCommands
{
localMap
[
v
]
=
true
}
}
}
// NB: when necessary, properties are described using negatives in order to
// NB: when necessary, properties are described using negatives in order to
...
...
cmd/ipfs/main.go
浏览文件 @
80370f06
...
@@ -92,6 +92,7 @@ func mainRet() int {
...
@@ -92,6 +92,7 @@ func mainRet() int {
os
.
Args
[
0
]
=
"ipfs"
os
.
Args
[
0
]
=
"ipfs"
buildEnv
:=
func
(
ctx
context
.
Context
,
req
*
cmds
.
Request
)
(
cmds
.
Environment
,
error
)
{
buildEnv
:=
func
(
ctx
context
.
Context
,
req
*
cmds
.
Request
)
(
cmds
.
Environment
,
error
)
{
checkDebug
(
req
)
repoPath
,
err
:=
getRepoPath
(
req
)
repoPath
,
err
:=
getRepoPath
(
req
)
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -151,12 +152,7 @@ func checkDebug(req *cmds.Request) {
...
@@ -151,12 +152,7 @@ func checkDebug(req *cmds.Request) {
}
}
func
makeExecutor
(
req
*
cmds
.
Request
,
env
interface
{})
(
cmds
.
Executor
,
error
)
{
func
makeExecutor
(
req
*
cmds
.
Request
,
env
interface
{})
(
cmds
.
Executor
,
error
)
{
checkDebug
(
req
)
details
:=
commandDetails
(
req
.
Path
)
details
,
err
:=
commandDetails
(
req
.
Path
,
Root
)
if
err
!=
nil
{
return
nil
,
err
}
client
,
err
:=
commandShouldRunOnDaemon
(
*
details
,
req
,
env
.
(
*
oldcmds
.
Context
))
client
,
err
:=
commandShouldRunOnDaemon
(
*
details
,
req
,
env
.
(
*
oldcmds
.
Context
))
if
err
!=
nil
{
if
err
!=
nil
{
return
nil
,
err
return
nil
,
err
...
@@ -200,25 +196,16 @@ func checkPermissions(path string) (bool, error) {
...
@@ -200,25 +196,16 @@ func checkPermissions(path string) (bool, error) {
return
true
,
nil
return
true
,
nil
}
}
// commandDetails returns a command's details for the command given by |path|
// commandDetails returns a command's details for the command given by |path|.
// within the |root| command tree.
func
commandDetails
(
path
[]
string
)
*
cmdDetails
{
//
// Returns an error if the command is not found in the Command tree.
func
commandDetails
(
path
[]
string
,
root
*
cmds
.
Command
)
(
*
cmdDetails
,
error
)
{
var
details
cmdDetails
var
details
cmdDetails
// find the last command in path that has a cmdDetailsMap entry
// find the last command in path that has a cmdDetailsMap entry
cmd
:=
root
for
i
:=
range
path
{
for
_
,
cmp
:=
range
path
{
if
cmdDetails
,
found
:=
cmdDetailsMap
[
strings
.
Join
(
path
[
:
i
+
1
],
"/"
)];
found
{
cmd
=
cmd
.
Subcommands
[
cmp
]
if
cmd
==
nil
{
return
nil
,
fmt
.
Errorf
(
"subcommand %s should be in root"
,
cmp
)
}
if
cmdDetails
,
found
:=
cmdDetailsMap
[
strings
.
Join
(
path
,
"/"
)];
found
{
details
=
cmdDetails
details
=
cmdDetails
}
}
}
}
return
&
details
,
nil
return
&
details
}
}
// commandShouldRunOnDaemon determines, from command details, whether a
// commandShouldRunOnDaemon determines, from command details, whether a
...
@@ -318,7 +305,7 @@ func startProfiling() (func(), error) {
...
@@ -318,7 +305,7 @@ func startProfiling() (func(), error) {
stopProfiling
:=
func
()
{
stopProfiling
:=
func
()
{
pprof
.
StopCPUProfile
()
pprof
.
StopCPUProfile
()
defer
ofi
.
Close
()
// captured by the closure
ofi
.
Close
()
// captured by the closure
}
}
return
stopProfiling
,
nil
return
stopProfiling
,
nil
}
}
...
...
core/core.go
浏览文件 @
80370f06
...
@@ -597,12 +597,7 @@ func (n *IpfsNode) teardown() error {
...
@@ -597,12 +597,7 @@ func (n *IpfsNode) teardown() error {
// OnlineMode returns whether or not the IpfsNode is in OnlineMode.
// OnlineMode returns whether or not the IpfsNode is in OnlineMode.
func
(
n
*
IpfsNode
)
OnlineMode
()
bool
{
func
(
n
*
IpfsNode
)
OnlineMode
()
bool
{
switch
n
.
mode
{
return
n
.
mode
==
onlineMode
case
onlineMode
:
return
true
default
:
return
false
}
}
}
// SetLocal will set the IpfsNode to local mode
// SetLocal will set the IpfsNode to local mode
...
@@ -619,17 +614,11 @@ func (n *IpfsNode) LocalMode() bool {
...
@@ -619,17 +614,11 @@ func (n *IpfsNode) LocalMode() bool {
// programmer error should not happen
// programmer error should not happen
panic
(
"local mode not set"
)
panic
(
"local mode not set"
)
}
}
switch
n
.
mode
{
return
n
.
mode
==
localMode
case
localMode
:
return
true
default
:
return
false
}
}
}
// Bootstrap will set and call the IpfsNodes bootstrap function.
// Bootstrap will set and call the IpfsNodes bootstrap function.
func
(
n
*
IpfsNode
)
Bootstrap
(
cfg
BootstrapConfig
)
error
{
func
(
n
*
IpfsNode
)
Bootstrap
(
cfg
BootstrapConfig
)
error
{
// TODO what should return value be when in offlineMode?
// TODO what should return value be when in offlineMode?
if
n
.
Routing
==
nil
{
if
n
.
Routing
==
nil
{
return
nil
return
nil
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论