core: do not run bloom filter if in a temoporary node mode
License: MIT Signed-off-by: Jakub Sztandera <kubuxu@protonmail.ch>
Jakub Sztandera committed
Jul 8, 2016 at 19:15 UTC
e85a39c61092dad7c294a209585b3ddd83efd387
2 files changed
+12
-2
cmd/ipfs/daemon.go
+2
-1
@@ -229,7 +229,8 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
229
230
// Start assembling node config
231
ncfg := &core.BuildCfg{
232
- Repo: repo,
232
+ Repo: repo,
233
+ Permament: true,
234
}
235
offline, _, _ := req.Option(offlineKwd).Bool()
236
ncfg.Online = !offline
core/builder.go
+10
-1
@@ -27,6 +27,10 @@ type BuildCfg struct {
27
// If online is set, the node will have networking enabled
28
Online bool
29
30
+ // If permament then node should run more expensive processes
31
+ // that will improve performance in long run
32
+ Permament bool
33
+
34
// If NilRepo is set, a repo backed by a nil datastore will be constructed
35
NilRepo bool
36
@@ -131,7 +135,12 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
135
136
var err error
137
bs := bstore.NewBlockstore(n.Repo.Datastore())
134
- n.Blockstore, err = bstore.CachedBlockstore(bs, ctx, bstore.DefaultCacheOpts())
138
+ opts := bstore.DefaultCacheOpts()
139
+ if !cfg.Permament {
140
+ opts.HasBloomFilterSize = 0
141
+ }
142
+
143
+ n.Blockstore, err = bstore.CachedBlockstore(bs, ctx, opts)
144
if err != nil {
145
return err
146
}