Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
bb4b99ef
提交
bb4b99ef
authored
4月 08, 2019
作者:
Łukasz Magiera
提交者:
Steven Allen
4月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Rename lcProcess.Run to Append, add docs
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
803512e4
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
15 行增加
和
5 行删除
+15
-5
helpers.go
core/node/helpers.go
+13
-4
ipns.go
core/node/ipns.go
+1
-1
go.mod
go.mod
+1
-0
没有找到文件。
core/node/helpers.go
浏览文件 @
bb4b99ef
...
@@ -6,6 +6,7 @@ import (
...
@@ -6,6 +6,7 @@ import (
config
"github.com/ipfs/go-ipfs-config"
config
"github.com/ipfs/go-ipfs-config"
uio
"github.com/ipfs/go-unixfs/io"
uio
"github.com/ipfs/go-unixfs/io"
"github.com/jbenet/goprocess"
"github.com/jbenet/goprocess"
"github.com/pkg/errors"
"go.uber.org/fx"
"go.uber.org/fx"
)
)
...
@@ -31,15 +32,23 @@ type lcProcess struct {
...
@@ -31,15 +32,23 @@ type lcProcess struct {
Proc
goprocess
.
Process
Proc
goprocess
.
Process
}
}
func
(
lp
*
lcProcess
)
Run
(
f
goprocess
.
ProcessFunc
)
{
// Append wraps ProcessFunc into a goprocess, and appends it to the lifecycle
proc
:=
make
(
chan
goprocess
.
Process
,
1
)
func
(
lp
*
lcProcess
)
Append
(
f
goprocess
.
ProcessFunc
)
{
// Hooks are guaranteed to run in sequence. If a hook fails to start, its
// OnStop won't be executed.
var
proc
goprocess
.
Process
lp
.
LC
.
Append
(
fx
.
Hook
{
lp
.
LC
.
Append
(
fx
.
Hook
{
OnStart
:
func
(
ctx
context
.
Context
)
error
{
OnStart
:
func
(
ctx
context
.
Context
)
error
{
proc
<-
lp
.
Proc
.
Go
(
f
)
proc
=
lp
.
Proc
.
Go
(
f
)
return
nil
return
nil
},
},
OnStop
:
func
(
ctx
context
.
Context
)
error
{
OnStop
:
func
(
ctx
context
.
Context
)
error
{
return
(
<-
proc
)
.
Close
()
// todo: respect ctx, somehow
if
proc
==
nil
{
// Theoretically this shouldn't ever happen
return
errors
.
New
(
"lcProcess: proc was nil"
)
}
return
proc
.
Close
()
// todo: respect ctx, somehow
},
},
})
})
}
}
...
...
core/node/ipns.go
浏览文件 @
bb4b99ef
...
@@ -66,6 +66,6 @@ func IpnsRepublisher(lc lcProcess, cfg *config.Config, namesys namesys.NameSyste
...
@@ -66,6 +66,6 @@ func IpnsRepublisher(lc lcProcess, cfg *config.Config, namesys namesys.NameSyste
repub
.
RecordLifetime
=
d
repub
.
RecordLifetime
=
d
}
}
lc
.
Run
(
repub
.
Run
)
lc
.
Append
(
repub
.
Run
)
return
nil
return
nil
}
}
go.mod
浏览文件 @
bb4b99ef
...
@@ -100,6 +100,7 @@ require (
...
@@ -100,6 +100,7 @@ require (
github.com/multiformats/go-multibase v0.0.1
github.com/multiformats/go-multibase v0.0.1
github.com/multiformats/go-multihash v0.0.1
github.com/multiformats/go-multihash v0.0.1
github.com/opentracing/opentracing-go v1.0.2
github.com/opentracing/opentracing-go v1.0.2
github.com/pkg/errors v0.8.1
github.com/prometheus/client_golang v0.9.2
github.com/prometheus/client_golang v0.9.2
github.com/syndtr/goleveldb v1.0.0
github.com/syndtr/goleveldb v1.0.0
github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc
github.com/whyrusleeping/base32 v0.0.0-20170828182744-c30ac30633cc
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论