1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-09-09 23:42:20 +08:00

replace nodebuilder with a nicer interface

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

use NewNode instead of NewIPFSNode in most of the codebase

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

make mocknet work with node constructor better

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

finish cleanup of old construction method

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

blockservice.New doesnt return an error anymore

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

break up node construction into separate function

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>

add error case to default filling on node constructor

License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
This commit is contained in:
Jeromy
2015-08-13 11:44:10 -07:00
parent 7abebb1653
commit 94000e6490
21 changed files with 262 additions and 410 deletions

View File

@ -192,9 +192,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
return
}
// Start assembling corebuilder
nb := core.NewNodeBuilder().Online()
nb.SetRepo(repo)
// Start assembling node config
ncfg := &core.BuildCfg{
Online: true,
Repo: repo,
}
routingOption, _, err := req.Option(routingOptionKwd).String()
if err != nil {
@ -215,10 +217,11 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
Addrs: []ma.Multiaddr{addr.Transport()},
})
}
nb.SetRouting(corerouting.SupernodeClient(infos...))
ncfg.Routing = corerouting.SupernodeClient(infos...)
}
node, err := nb.Build(req.Context())
node, err := core.NewNode(req.Context(), ncfg)
if err != nil {
log.Error("error from node construction: ", err)
res.SetError(err, cmds.ErrNormal)