Skip to content

Commit 59805f0

Browse files
authored
Merge pull request #5414 from ipfs/nit/no-caching-nil-repo
don't bother caching if we're using a nil repo
2 parents 1b4972b + 5bc843e commit 59805f0

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

core/builder.go

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -205,22 +205,24 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
205205
opts.HasBloomFilterSize = 0
206206
}
207207

208-
wbs, err := bstore.CachedBlockstore(ctx, bs, opts)
209-
if err != nil {
210-
return err
208+
if !cfg.NilRepo {
209+
bs, err = bstore.CachedBlockstore(ctx, bs, opts)
210+
if err != nil {
211+
return err
212+
}
211213
}
212214

213-
wbs = bstore.NewIdStore(wbs)
215+
bs = bstore.NewIdStore(bs)
214216

215-
wbs = cidv0v1.NewBlockstore(wbs)
217+
bs = cidv0v1.NewBlockstore(bs)
216218

217-
n.BaseBlocks = wbs
219+
n.BaseBlocks = bs
218220
n.GCLocker = bstore.NewGCLocker()
219-
n.Blockstore = bstore.NewGCBlockstore(wbs, n.GCLocker)
221+
n.Blockstore = bstore.NewGCBlockstore(bs, n.GCLocker)
220222

221223
if conf.Experimental.FilestoreEnabled || conf.Experimental.UrlstoreEnabled {
222224
// hash security
223-
n.Filestore = filestore.NewFilestore(wbs, n.Repo.FileManager())
225+
n.Filestore = filestore.NewFilestore(bs, n.Repo.FileManager())
224226
n.Blockstore = bstore.NewGCBlockstore(n.Filestore, n.GCLocker)
225227
n.Blockstore = &verifbs.VerifBSGC{GCBlockstore: n.Blockstore}
226228
}

0 commit comments

Comments
 (0)