Skip to content
项目
群组
代码片段
帮助
当前项目
正在载入...
登录 / 注册
切换导航面板
G
go-ipfs
概览
概览
详情
活动
周期分析
版本库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
问题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
日程表
图表
维基
Wiki
代码片段
代码片段
成员
成员
折叠边栏
关闭边栏
活动
图像
聊天
创建新问题
作业
提交
问题看板
Open sidebar
jihao
go-ipfs
Commits
bfaffb2d
提交
bfaffb2d
authored
4月 01, 2019
作者:
Łukasz Magiera
提交者:
Steven Allen
4月 17, 2019
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix bootstrap
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
上级
cc2be2e7
隐藏空白字符变更
内嵌
并排
正在显示
3 个修改的文件
包含
52 行增加
和
49 行删除
+52
-49
builder.go
core/builder.go
+24
-15
core.go
core/core.go
+20
-20
ncore.go
core/ncore.go
+8
-14
没有找到文件。
core/builder.go
浏览文件 @
bfaffb2d
...
@@ -245,18 +245,18 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
...
@@ -245,18 +245,18 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
n
.
IsOnline
=
cfg
.
Online
n
.
IsOnline
=
cfg
.
Online
n
.
app
=
app
n
.
app
=
app
/* n := &IpfsNode{
/* n := &IpfsNode{
IsOnline: cfg.Online,
IsOnline: cfg.Online,
Repo: cfg.Repo,
Repo: cfg.Repo,
ctx: ctx,
ctx: ctx,
Peerstore: pstoremem.NewPeerstore(),
Peerstore: pstoremem.NewPeerstore(),
}
}
n.RecordValidator = record.NamespacedValidator{
n.RecordValidator = record.NamespacedValidator{
"pk": record.PublicKeyValidator{},
"pk": record.PublicKeyValidator{},
"ipns": ipns.Validator{KeyBook: n.Peerstore},
"ipns": ipns.Validator{KeyBook: n.Peerstore},
}
}
*/
*/
// TODO: port to lifetimes
// TODO: port to lifetimes
// n.proc = goprocessctx.WithContextAndTeardown(ctx, n.teardown)
// n.proc = goprocessctx.WithContextAndTeardown(ctx, n.teardown)
...
@@ -264,11 +264,20 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
...
@@ -264,11 +264,20 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
n.Close()
n.Close()
return nil, err
return nil, err
}*/
}*/
if
app
.
Err
()
!=
nil
{
if
app
.
Err
()
!=
nil
{
return
nil
,
app
.
Err
()
return
nil
,
app
.
Err
()
}
}
if
err
:=
app
.
Start
(
ctx
);
err
!=
nil
{
return
nil
,
err
}
// TODO: DI-ify bootstrap
if
!
cfg
.
Online
{
return
n
,
nil
}
return
n
,
app
.
Start
(
ctx
)
return
n
,
n
.
Bootstrap
(
DefaultBootstrapConfig
)
}
}
func
isTooManyFDError
(
err
error
)
bool
{
func
isTooManyFDError
(
err
error
)
bool
{
...
...
core/core.go
浏览文件 @
bfaffb2d
...
@@ -100,13 +100,13 @@ type IpfsNode struct {
...
@@ -100,13 +100,13 @@ type IpfsNode struct {
Repo
repo
.
Repo
Repo
repo
.
Repo
// Local node
// Local node
Pinning
pin
.
Pinner
// the pinning manager
Pinning
pin
.
Pinner
// the pinning manager
Mounts
Mounts
`optional:"true"`
// current mount state, if any.
Mounts
Mounts
`optional:"true"`
// current mount state, if any.
PrivateKey
ic
.
PrivKey
// the local node's private Key
PrivateKey
ic
.
PrivKey
// the local node's private Key
PNetFingerprint
PNetFingerprint
`optional:"true"`
// fingerprint of private network
PNetFingerprint
PNetFingerprint
`optional:"true"`
// fingerprint of private network
// Services
// Services
Peerstore
pstore
.
Peerstore
`optional:"true"`
// storage for other Peer instances
Peerstore
pstore
.
Peerstore
`optional:"true"`
// storage for other Peer instances
Blockstore
bstore
.
GCBlockstore
// the block store (lower level)
Blockstore
bstore
.
GCBlockstore
// the block store (lower level)
Filestore
*
filestore
.
Filestore
// the filestore blockstore
Filestore
*
filestore
.
Filestore
// the filestore blockstore
BaseBlocks
bstore
.
Blockstore
// the raw blockstore, no filestore wrapping
BaseBlocks
bstore
.
Blockstore
// the raw blockstore, no filestore wrapping
...
@@ -114,35 +114,35 @@ type IpfsNode struct {
...
@@ -114,35 +114,35 @@ type IpfsNode struct {
Blocks
bserv
.
BlockService
// the block service, get/add blocks.
Blocks
bserv
.
BlockService
// the block service, get/add blocks.
DAG
ipld
.
DAGService
// the merkle dag service, get/add objects.
DAG
ipld
.
DAGService
// the merkle dag service, get/add objects.
Resolver
*
resolver
.
Resolver
// the path resolution system
Resolver
*
resolver
.
Resolver
// the path resolution system
Reporter
metrics
.
Reporter
`optional:"true"`
Reporter
metrics
.
Reporter
`optional:"true"`
Discovery
discovery
.
Service
`optional:"true"`
Discovery
discovery
.
Service
`optional:"true"`
FilesRoot
*
mfs
.
Root
FilesRoot
*
mfs
.
Root
RecordValidator
record
.
Validator
RecordValidator
record
.
Validator
// Online
// Online
PeerHost
p2phost
.
Host
`optional:"true"`
// the network host (server+client)
PeerHost
p2phost
.
Host
`optional:"true"`
// the network host (server+client)
Bootstrapper
io
.
Closer
`optional:"true"`
// the periodic bootstrapper
Bootstrapper
io
.
Closer
`optional:"true"`
// the periodic bootstrapper
Routing
routing
.
IpfsRouting
`optional:"true"`
// the routing system. recommend ipfs-dht
Routing
routing
.
IpfsRouting
`optional:"true"`
// the routing system. recommend ipfs-dht
Exchange
exchange
.
Interface
// the block exchange + strategy (bitswap)
Exchange
exchange
.
Interface
// the block exchange + strategy (bitswap)
Namesys
namesys
.
NameSystem
// the name system, resolves paths to hashes
Namesys
namesys
.
NameSystem
// the name system, resolves paths to hashes
Provider
provider
.
Provider
// the value provider system
Provider
provider
.
Provider
// the value provider system
Reprovider
*
rp
.
Reprovider
`optional:"true"`
// the value reprovider system
Reprovider
*
rp
.
Reprovider
`optional:"true"`
// the value reprovider system
IpnsRepub
*
ipnsrp
.
Republisher
`optional:"true"`
IpnsRepub
*
ipnsrp
.
Republisher
`optional:"true"`
AutoNAT
*
autonat
.
AutoNATService
`optional:"true"`
AutoNAT
*
autonat
.
AutoNATService
`optional:"true"`
PubSub
*
pubsub
.
PubSub
`optional:"true"`
PubSub
*
pubsub
.
PubSub
`optional:"true"`
PSRouter
*
psrouter
.
PubsubValueStore
`optional:"true"`
PSRouter
*
psrouter
.
PubsubValueStore
`optional:"true"`
DHT
*
dht
.
IpfsDHT
`optional:"true"`
DHT
*
dht
.
IpfsDHT
`optional:"true"`
P2P
*
p2p
.
P2P
`optional:"true"`
P2P
*
p2p
.
P2P
`optional:"true"`
Process
goprocess
.
Process
Process
goprocess
.
Process
ctx
context
.
Context
ctx
context
.
Context
app
*
fx
.
App
app
*
fx
.
App
// Flags
// Flags
IsOnline
bool
`optional:"true"`
// Online is set when networking is enabled.
IsOnline
bool
`optional:"true"`
// Online is set when networking is enabled.
IsDaemon
bool
`optional:"true"`
// Daemon is set when running on a long-running daemon.
IsDaemon
bool
`optional:"true"`
// Daemon is set when running on a long-running daemon.
}
}
// Mounts defines what the node's mount state is. This should
// Mounts defines what the node's mount state is. This should
...
@@ -206,9 +206,9 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
...
@@ -206,9 +206,9 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
log
.
Warning
(
"This might be configuration mistake."
)
log
.
Warning
(
"This might be configuration mistake."
)
}
}
}
}
//case <-n.Process().Closing():
//case <-n.Process().Closing():
// t.Stop()
// t.Stop()
// return
// return
}
}
}
}
}()
}()
...
...
core/ncore.go
浏览文件 @
bfaffb2d
...
@@ -452,11 +452,11 @@ func p2pHost(lc fx.Lifecycle, params p2pHostIn) (out p2pHostOut, err error) {
...
@@ -452,11 +452,11 @@ func p2pHost(lc fx.Lifecycle, params p2pHostIn) (out p2pHostOut, err error) {
type
p2pRoutingIn
struct
{
type
p2pRoutingIn
struct
{
fx
.
In
fx
.
In
BCfg
*
BuildCfg
BCfg
*
BuildCfg
Repo
repo
.
Repo
Repo
repo
.
Repo
Validator
record
.
Validator
Validator
record
.
Validator
Host
p2phost
.
Host
Host
p2phost
.
Host
PubSub
*
pubsub
.
PubSub
PubSub
*
pubsub
.
PubSub
BaseRouting
BaseRouting
BaseRouting
BaseRouting
}
}
...
@@ -553,7 +553,6 @@ func offlineNamesysCtor(rt routing.IpfsRouting, repo repo.Repo) (namesys.NameSys
...
@@ -553,7 +553,6 @@ func offlineNamesysCtor(rt routing.IpfsRouting, repo repo.Repo) (namesys.NameSys
return
namesys
.
NewNameSystem
(
rt
,
repo
.
Datastore
(),
0
),
nil
return
namesys
.
NewNameSystem
(
rt
,
repo
.
Datastore
(),
0
),
nil
}
}
////////////
////////////
// IPFS services
// IPFS services
...
@@ -621,7 +620,7 @@ func ipnsRepublisher(lc lcProcess, cfg *iconfig.Config, namesys namesys.NameSyst
...
@@ -621,7 +620,7 @@ func ipnsRepublisher(lc lcProcess, cfg *iconfig.Config, namesys namesys.NameSyst
}
}
type
discoveryHandler
struct
{
type
discoveryHandler
struct
{
ctx
context
.
Context
ctx
context
.
Context
host
p2phost
.
Host
host
p2phost
.
Host
}
}
...
@@ -636,7 +635,7 @@ func (dh *discoveryHandler) HandlePeerFound(p pstore.PeerInfo) {
...
@@ -636,7 +635,7 @@ func (dh *discoveryHandler) HandlePeerFound(p pstore.PeerInfo) {
func
newDiscoveryHandler
(
lc
fx
.
Lifecycle
,
host
p2phost
.
Host
)
*
discoveryHandler
{
func
newDiscoveryHandler
(
lc
fx
.
Lifecycle
,
host
p2phost
.
Host
)
*
discoveryHandler
{
return
&
discoveryHandler
{
return
&
discoveryHandler
{
ctx
:
lifecycleCtx
(
lc
),
ctx
:
lifecycleCtx
(
lc
),
host
:
host
,
host
:
host
,
}
}
}
}
...
@@ -739,11 +738,6 @@ func files(lc fx.Lifecycle, repo repo.Repo, dag format.DAGService) (*mfs.Root, e
...
@@ -739,11 +738,6 @@ func files(lc fx.Lifecycle, repo repo.Repo, dag format.DAGService) (*mfs.Root, e
return
mfs
.
NewRoot
(
ctx
,
dag
,
nd
,
pf
)
return
mfs
.
NewRoot
(
ctx
,
dag
,
nd
,
pf
)
}
}
// TODO !!!!!!!!
func
bootstrap
(
n
IpfsNode
)
error
{
return
n
.
Bootstrap
(
DefaultBootstrapConfig
)
}
////////////
////////////
// Hacks
// Hacks
...
@@ -765,7 +759,7 @@ func lifecycleCtx(lc fx.Lifecycle) context.Context {
...
@@ -765,7 +759,7 @@ func lifecycleCtx(lc fx.Lifecycle) context.Context {
type
lcProcess
struct
{
type
lcProcess
struct
{
fx
.
In
fx
.
In
LC
fx
.
Lifecycle
LC
fx
.
Lifecycle
Proc
goprocess
.
Process
Proc
goprocess
.
Process
}
}
...
...
编写
预览
Markdown
格式
0%
重试
或
添加新文件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
请先完成此评论的编辑!
取消
请
注册
或者
登录
后发表评论