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
707874c3
Commit
707874c3
authored
Jan 10, 2015
by
Brian Tiger Chow
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
refactor(core): init node.Blocks in shared NewIPFSNode constructor
parent
34e8f3ee
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
11 deletions
+4
-11
core/core.go
core/core.go
+4
-5
test/epictest/core.go
test/epictest/core.go
+0
-6
No files found.
core/core.go
View file @
707874c3
...
...
@@ -101,6 +101,10 @@ func NewIPFSNode(ctx context.Context, option ConfigOption) (*IpfsNode, error) {
// to be initialized at this point, and 2) which variables will be
// initialized after this point.
node
.
Blocks
,
err
=
bserv
.
New
(
node
.
Blockstore
,
node
.
Exchange
)
if
err
!=
nil
{
return
nil
,
debugerror
.
Wrap
(
err
)
}
node
.
DAG
=
merkledag
.
NewDAGService
(
node
.
Blocks
)
node
.
Pinning
,
err
=
pin
.
LoadPinner
(
node
.
Datastore
,
node
.
DAG
)
if
err
!=
nil
{
...
...
@@ -167,11 +171,6 @@ func Standard(cfg *config.Config, online bool) ConfigOption {
n
.
Exchange
=
offline
.
Exchange
(
n
.
Blockstore
)
}
n
.
Blocks
,
err
=
bserv
.
New
(
n
.
Blockstore
,
n
.
Exchange
)
if
err
!=
nil
{
return
nil
,
debugerror
.
Wrap
(
err
)
}
success
=
true
return
n
,
nil
}
...
...
test/epictest/core.go
View file @
707874c3
...
...
@@ -6,7 +6,6 @@ import (
sync
"github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore/sync"
blockstore
"github.com/jbenet/go-ipfs/blocks/blockstore"
blockservice
"github.com/jbenet/go-ipfs/blockservice"
core
"github.com/jbenet/go-ipfs/core"
bitswap
"github.com/jbenet/go-ipfs/exchange/bitswap"
bsnet
"github.com/jbenet/go-ipfs/exchange/bitswap/network"
...
...
@@ -36,17 +35,12 @@ func MocknetTestRepo(p peer.ID, h host.Host, conf testutil.LatencyConfig) core.C
return
nil
,
err
}
exch
:=
bitswap
.
New
(
ctx
,
p
,
bsn
,
bstore
,
alwaysSendToPeer
)
blockservice
,
err
:=
blockservice
.
New
(
bstore
,
exch
)
if
err
!=
nil
{
return
nil
,
err
}
return
&
core
.
IpfsNode
{
Peerstore
:
h
.
Peerstore
(),
Blockstore
:
bstore
,
Exchange
:
exch
,
Datastore
:
ds
,
PeerHost
:
h
,
Blocks
:
blockservice
,
Routing
:
dhtt
,
Identity
:
p
,
DHT
:
dhtt
,
...
...
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