Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(core): NewIPFSNode constructor #538

Merged
merged 23 commits into from
Jan 11, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
007ffd4
refactor: move LatencyConfig
Jan 11, 2015
57b3ffa
feat: new core constructor + config options (Standard, Online, Offline)
Jan 11, 2015
4c2eda2
refactor: remove deprecated function
Jan 11, 2015
2c3fb43
feat: expose IpfsNode.Bootstrap() method
Jan 11, 2015
85401d5
refactor: use the Core in the integration test
Jan 11, 2015
efb75ee
refactor: move add and cat to the core
Jan 11, 2015
401b8f4
misc: move initialization sqaush
Jan 11, 2015
5c46597
use the core.NewIPFSNode constructor
Jan 11, 2015
7cebb33
fix: remove dead code
Jan 11, 2015
91808e1
refactor: use core.ConfigOption return type
Jan 11, 2015
7fa5d81
refactor(core): rename
Jan 11, 2015
34e8f3e
refactor(core): init DAG and its dependents in shared constructor
Jan 11, 2015
707874c
refactor(core): init node.Blocks in shared NewIPFSNode constructor
Jan 11, 2015
8e42e86
hack(core): instantiate peerstore at the end if it hasn't already bee…
Jan 11, 2015
eb6c40d
refactor(core): isolate the complex initialization of PeerHost constr…
Jan 11, 2015
ca8190a
refactor(core): isolate complex DHT initialization
Jan 11, 2015
9d43884
refactor(core): distinguish Online services
Jan 11, 2015
b0f7143
refactor(core): distinguish repo.Repo components
Jan 11, 2015
130532c
rm errTODO
Jan 11, 2015
ddf14be
refactor(core): replace online bool with mode type
Jan 11, 2015
223ee4d
refactor(core): move Add, Cat to core/io
Jan 11, 2015
033e33d
feat(core): expose IpfsNode.Resolve
Jan 11, 2015
63c0d41
fix(core): perform sophisticated boostrap operation
Jan 11, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion cmd/ipfs/init.go
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@ func doInit(configRoot string, dspathOverride string, force bool, nBitsForKeypai
func addTheWelcomeFile(conf *config.Config) error {
// TODO extract this file creation operation into a function
ctx, cancel := context.WithCancel(context.Background())
nd, err := core.NewIpfsNode(ctx, conf, false)
nd, err := core.NewIPFSNode(ctx, core.Offline(conf))
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/ipfs/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ func (i *cmdInvocation) constructNodeFunc(ctx context.Context) func() (*core.Ipf

// ok everything is good. set it on the invocation (for ownership)
// and return it.
i.node, err = core.NewIpfsNode(ctx, cfg, cmdctx.Online)
i.node, err = core.NewIPFSNode(ctx, core.Standard(cfg, cmdctx.Online))
return i.node, err
}
}
Expand Down
15 changes: 2 additions & 13 deletions core/bootstrap.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func superviseConnections(parent context.Context,
h host.Host,
route *dht.IpfsDHT, // TODO depend on abstract interface for testing purposes
store peer.Peerstore,
peers []config.BootstrapPeer) error {
peers []peer.PeerInfo) error {

for {
ctx, _ := context.WithTimeout(parent, connectiontimeout)
Expand All @@ -51,7 +51,7 @@ func bootstrap(ctx context.Context,
h host.Host,
r *dht.IpfsDHT,
ps peer.Peerstore,
boots []config.BootstrapPeer) error {
bootstrapPeers []peer.PeerInfo) error {

connectedPeers := h.Network().Peers()
if len(connectedPeers) >= recoveryThreshold {
Expand All @@ -66,17 +66,6 @@ func bootstrap(ctx context.Context,
log.Event(ctx, "bootstrapStart", h.ID())
log.Debugf("%s bootstrapping to %d more nodes", h.ID(), numCxnsToCreate)

var bootstrapPeers []peer.PeerInfo
for _, bootstrap := range boots {
p, err := toPeer(bootstrap)
if err != nil {
log.Event(ctx, "bootstrapError", h.ID(), lgbl.Error(err))
log.Errorf("%s bootstrap error: %s", h.ID(), err)
return err
}
bootstrapPeers = append(bootstrapPeers, p)
}

var notConnected []peer.PeerInfo
for _, p := range bootstrapPeers {
if h.Network().Connectedness(p.ID) != inet.Connected {
Expand Down
Loading