Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
9bcf072c
提交
9bcf072c
authored
4月 26, 2019
作者:
Łukasz Magiera
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
WIP cleanup config handling in core
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
6b72593b
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
27 行增加
和
16 行删除
+27
-16
builder.go
core/node/builder.go
+8
-3
groups.go
core/node/groups.go
+19
-6
helpers.go
core/node/helpers.go
+0
-7
没有找到文件。
core/node/builder.go
浏览文件 @
9bcf072c
...
...
@@ -84,10 +84,10 @@ func (cfg *BuildCfg) fillDefaults() error {
}
// options creates fx option group from this build config
func
(
cfg
*
BuildCfg
)
options
(
ctx
context
.
Context
)
fx
.
Option
{
func
(
cfg
*
BuildCfg
)
options
(
ctx
context
.
Context
)
(
fx
.
Option
,
*
cfg
.
Config
)
{
err
:=
cfg
.
fillDefaults
()
if
err
!=
nil
{
return
fx
.
Error
(
err
)
return
fx
.
Error
(
err
)
,
nil
}
repoOption
:=
fx
.
Provide
(
func
(
lc
fx
.
Lifecycle
)
repo
.
Repo
{
...
...
@@ -112,12 +112,17 @@ func (cfg *BuildCfg) options(ctx context.Context) fx.Option {
return
cfg
.
Routing
})
conf
,
err
:=
cfg
.
Repo
.
Config
()
if
err
!=
nil
{
return
fx
.
Error
(
err
),
nil
}
return
fx
.
Options
(
repoOption
,
hostOption
,
routingOption
,
metricsCtx
,
)
)
,
conf
}
func
defaultRepo
(
dstore
repo
.
Datastore
)
(
repo
.
Repo
,
error
)
{
...
...
core/node/groups.go
浏览文件 @
9bcf072c
...
...
@@ -9,6 +9,7 @@ import (
offline
"github.com/ipfs/go-ipfs-exchange-offline"
offroute
"github.com/ipfs/go-ipfs-routing/offline"
uio
"github.com/ipfs/go-unixfs/io"
"github.com/ipfs/go-path/resolver"
"go.uber.org/fx"
)
...
...
@@ -122,21 +123,33 @@ func Networked(cfg *BuildCfg) fx.Option {
}
// IPFS builds a group of fx Options based on the passed BuildCfg
func
IPFS
(
ctx
context
.
Context
,
cfg
*
BuildCfg
)
fx
.
Option
{
func
IPFS
(
ctx
context
.
Context
,
bcfg
*
BuildCfg
)
fx
.
Option
{
if
bcfg
==
nil
{
bcfg
=
new
(
BuildCfg
)
}
bcfgOpts
,
cfg
:=
bcfg
.
options
(
ctx
)
if
cfg
==
nil
{
cfg
=
new
(
BuildCfg
)
return
bcfgOpts
// error
}
// TEMP: setting global sharding switch here
uio
.
UseHAMTSharding
=
cfg
.
Experimental
.
ShardingEnabled
return
fx
.
Options
(
cfg
.
options
(
ctx
)
,
bcfgOpts
,
fx
.
Provide
(
baseProcess
),
fx
.
Invoke
(
setupSharding
),
Storage
(
cfg
),
Storage
(
b
cfg
),
Identity
,
IPNS
,
Networked
(
cfg
),
Networked
(
b
cfg
),
Core
,
)
...
...
core/node/helpers.go
浏览文件 @
9bcf072c
...
...
@@ -3,8 +3,6 @@ package node
import
(
"context"
config
"github.com/ipfs/go-ipfs-config"
uio
"github.com/ipfs/go-unixfs/io"
"github.com/jbenet/goprocess"
"github.com/pkg/errors"
"go.uber.org/fx"
...
...
@@ -45,11 +43,6 @@ func maybeProvide(opt interface{}, enable bool) fx.Option {
return
fx
.
Options
()
}
func
setupSharding
(
cfg
*
config
.
Config
)
{
// TEMP: setting global sharding switch here
uio
.
UseHAMTSharding
=
cfg
.
Experimental
.
ShardingEnabled
}
// baseProcess creates a goprocess which is closed when the lifecycle signals it to stop
func
baseProcess
(
lc
fx
.
Lifecycle
)
goprocess
.
Process
{
p
:=
goprocess
.
WithParent
(
goprocess
.
Background
())
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论