Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
go-dms3
Commits
bfaffb2d
Commit
bfaffb2d
authored
Apr 01, 2019
by
Łukasz Magiera
Committed by
Steven Allen
Apr 17, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix bootstrap
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
cc2be2e7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
49 deletions
+52
-49
core/builder.go
core/builder.go
+24
-15
core/core.go
core/core.go
+20
-20
core/ncore.go
core/ncore.go
+8
-14
No files found.
core/builder.go
View file @
bfaffb2d
...
...
@@ -245,18 +245,18 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
n
.
IsOnline
=
cfg
.
Online
n
.
app
=
app
/* n := &IpfsNode{
IsOnline: cfg.Online,
Repo: cfg.Repo,
ctx: ctx,
Peerstore: pstoremem.NewPeerstore(),
}
/* n := &IpfsNode{
IsOnline: cfg.Online,
Repo: cfg.Repo,
ctx: ctx,
Peerstore: pstoremem.NewPeerstore(),
}
n.RecordValidator = record.NamespacedValidator{
"pk": record.PublicKeyValidator{},
"ipns": ipns.Validator{KeyBook: n.Peerstore},
}
*/
n.RecordValidator = record.NamespacedValidator{
"pk": record.PublicKeyValidator{},
"ipns": ipns.Validator{KeyBook: n.Peerstore},
}
*/
// TODO: port to lifetimes
// n.proc = goprocessctx.WithContextAndTeardown(ctx, n.teardown)
...
...
@@ -264,11 +264,20 @@ func NewNode(ctx context.Context, cfg *BuildCfg) (*IpfsNode, error) {
n.Close()
return nil, err
}*/
if
app
.
Err
()
!=
nil
{
return
nil
,
app
.
Err
()
}
if
app
.
Err
()
!=
nil
{
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
{
...
...
core/core.go
View file @
bfaffb2d
...
...
@@ -100,13 +100,13 @@ type IpfsNode struct {
Repo repo.Repo
// Local node
Pinning
pin
.
Pinner
// the pinning manager
Mounts
Mounts
`optional:"true"`
// current mount state, if any.
PrivateKey
ic
.
PrivKey
// the local node's private Key
PNetFingerprint
PNetFingerprint
`optional:"true"`
// fingerprint of private network
Pinning pin.Pinner
// the pinning manager
Mounts Mounts
`optional:"true"` // current mount state, if any.
PrivateKey ic.PrivKey
// the local node's private Key
PNetFingerprint PNetFingerprint `optional:"true"` // fingerprint of private network
// 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)
Filestore *filestore.Filestore // the filestore blockstore
BaseBlocks bstore.Blockstore // the raw blockstore, no filestore wrapping
...
...
@@ -114,35 +114,35 @@ type IpfsNode struct {
Blocks bserv.BlockService // the block service, get/add blocks.
DAG ipld.DAGService // the merkle dag service, get/add objects.
Resolver *resolver.Resolver // the path resolution system
Reporter
metrics
.
Reporter
`optional:"true"`
Discovery
discovery
.
Service
`optional:"true"`
Reporter metrics.Reporter
`optional:"true"`
Discovery discovery.Service
`optional:"true"`
FilesRoot *mfs.Root
RecordValidator record.Validator
// 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
Routing routing.IpfsRouting `optional:"true"` // the routing system. recommend ipfs-dht
Exchange exchange.Interface // the block exchange + strategy (bitswap)
Namesys namesys.NameSystem // the name system, resolves paths to hashes
Provider
provider
.
Provider
// the value provider system
Reprovider
*
rp
.
Reprovider
`optional:"true"`
// the value reprovider system
Provider provider.Provider
// the value provider system
Reprovider *rp.Reprovider
`optional:"true"` // the value reprovider system
IpnsRepub *ipnsrp.Republisher `optional:"true"`
AutoNAT
*
autonat
.
AutoNATService
`optional:"true"`
PubSub
*
pubsub
.
PubSub
`optional:"true"`
AutoNAT *autonat.AutoNATService
`optional:"true"`
PubSub *pubsub.PubSub
`optional:"true"`
PSRouter *psrouter.PubsubValueStore `optional:"true"`
DHT
*
dht
.
IpfsDHT
`optional:"true"`
P2P
*
p2p
.
P2P
`optional:"true"`
DHT *dht.IpfsDHT
`optional:"true"`
P2P *p2p.P2P
`optional:"true"`
Process goprocess.Process
ctx
context
.
Context
ctx
context.Context
app *fx.App
// Flags
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.
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.
}
// Mounts defines what the node's mount state is. This should
...
...
@@ -206,9 +206,9 @@ func (n *IpfsNode) startOnlineServices(ctx context.Context, routingOption Routin
log.Warning("This might be configuration mistake.")
}
}
//case <-n.Process().Closing():
// t.Stop()
// return
//case <-n.Process().Closing():
// t.Stop()
// return
}
}
}()
...
...
core/ncore.go
View file @
bfaffb2d
...
...
@@ -452,11 +452,11 @@ func p2pHost(lc fx.Lifecycle, params p2pHostIn) (out p2pHostOut, err error) {
type
p2pRoutingIn
struct
{
fx
.
In
BCfg
*
BuildCfg
Repo
repo
.
Repo
Validator
record
.
Validator
Host
p2phost
.
Host
PubSub
*
pubsub
.
PubSub
BCfg
*
BuildCfg
Repo
repo
.
Repo
Validator
record
.
Validator
Host
p2phost
.
Host
PubSub
*
pubsub
.
PubSub
BaseRouting
BaseRouting
}
...
...
@@ -553,7 +553,6 @@ func offlineNamesysCtor(rt routing.IpfsRouting, repo repo.Repo) (namesys.NameSys
return
namesys
.
NewNameSystem
(
rt
,
repo
.
Datastore
(),
0
),
nil
}
////////////
// IPFS services
...
...
@@ -621,7 +620,7 @@ func ipnsRepublisher(lc lcProcess, cfg *iconfig.Config, namesys namesys.NameSyst
}
type
discoveryHandler
struct
{
ctx
context
.
Context
ctx
context
.
Context
host
p2phost
.
Host
}
...
...
@@ -636,7 +635,7 @@ func (dh *discoveryHandler) HandlePeerFound(p pstore.PeerInfo) {
func
newDiscoveryHandler
(
lc
fx
.
Lifecycle
,
host
p2phost
.
Host
)
*
discoveryHandler
{
return
&
discoveryHandler
{
ctx
:
lifecycleCtx
(
lc
),
ctx
:
lifecycleCtx
(
lc
),
host
:
host
,
}
}
...
...
@@ -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
)
}
// TODO !!!!!!!!
func
bootstrap
(
n
IpfsNode
)
error
{
return
n
.
Bootstrap
(
DefaultBootstrapConfig
)
}
////////////
// Hacks
...
...
@@ -765,7 +759,7 @@ func lifecycleCtx(lc fx.Lifecycle) context.Context {
type
lcProcess
struct
{
fx
.
In
LC
fx
.
Lifecycle
LC
fx
.
Lifecycle
Proc
goprocess
.
Process
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment