提交 e85a39c6 作者: Jakub Sztandera

core: do not run bloom filter if in a temoporary node mode

License: MIT
Signed-off-by: 's avatarJakub Sztandera <kubuxu@protonmail.ch>
上级 61a3d127
......@@ -229,7 +229,8 @@ func daemonFunc(req cmds.Request, res cmds.Response) {
// Start assembling node config
ncfg := &core.BuildCfg{
Repo: repo,
Repo: repo,
Permament: true,
}
offline, _, _ := req.Option(offlineKwd).Bool()
ncfg.Online = !offline
......
......@@ -27,6 +27,10 @@ type BuildCfg struct {
// If online is set, the node will have networking enabled
Online bool
// If permament then node should run more expensive processes
// that will improve performance in long run
Permament bool
// If NilRepo is set, a repo backed by a nil datastore will be constructed
NilRepo bool
......@@ -131,7 +135,12 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
var err error
bs := bstore.NewBlockstore(n.Repo.Datastore())
n.Blockstore, err = bstore.CachedBlockstore(bs, ctx, bstore.DefaultCacheOpts())
opts := bstore.DefaultCacheOpts()
if !cfg.Permament {
opts.HasBloomFilterSize = 0
}
n.Blockstore, err = bstore.CachedBlockstore(bs, ctx, opts)
if err != nil {
return err
}
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论