@cryptotaxi247 / kubo / commits / 5bc843e5c

don't bother caching if we're using a nil repo

(it'll be wrong anyways) License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>

Steven Allen committed Aug 31, 2018 at 12:21 UTC 5bc843e5c8dfcc0c8aa928aaded37725ab029286
1 file changed +10 -8
core/builder.go
+10 -8
@@ -205,22 +205,24 @@ func setupNode(ctx context.Context, n *IpfsNode, cfg *BuildCfg) error {
205 opts.HasBloomFilterSize = 0
206 }
207
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 + }
213 }
214
213 - wbs = bstore.NewIdStore(wbs)
215 + bs = bstore.NewIdStore(bs)
216
215 - wbs = cidv0v1.NewBlockstore(wbs)
217 + bs = cidv0v1.NewBlockstore(bs)
218
217 - n.BaseBlocks = wbs
219 + n.BaseBlocks = bs
220 n.GCLocker = bstore.NewGCLocker()
219 - n.Blockstore = bstore.NewGCBlockstore(wbs, n.GCLocker)
221 + n.Blockstore = bstore.NewGCBlockstore(bs, n.GCLocker)
222
223 if conf.Experimental.FilestoreEnabled || conf.Experimental.UrlstoreEnabled {
224 // hash security
223 - n.Filestore = filestore.NewFilestore(wbs, n.Repo.FileManager())
225 + n.Filestore = filestore.NewFilestore(bs, n.Repo.FileManager())
226 n.Blockstore = bstore.NewGCBlockstore(n.Filestore, n.GCLocker)
227 n.Blockstore = &verifbs.VerifBSGC{GCBlockstore: n.Blockstore}
228 }