diff --git a/core/node/groups.go b/core/node/groups.go index ab50b3c0a39..070911cc0ba 100644 --- a/core/node/groups.go +++ b/core/node/groups.go @@ -122,6 +122,7 @@ func LibP2P(bcfg *BuildCfg, cfg *config.Config) fx.Option { func Storage(bcfg *BuildCfg, cfg *config.Config) fx.Option { cacheOpts := blockstore.DefaultCacheOpts() cacheOpts.HasBloomFilterSize = cfg.Datastore.BloomFilterSize + cacheOpts.HasARCCacheSize = cfg.Datastore.ARCCacheSize if !bcfg.Permanent { cacheOpts.HasBloomFilterSize = 0 } diff --git a/core/node/storage.go b/core/node/storage.go index f1d9495fe53..f6bbd3b9270 100644 --- a/core/node/storage.go +++ b/core/node/storage.go @@ -53,7 +53,7 @@ func BaseBlockstoreCtor(cacheOpts blockstore.CacheOpts, nilRepo bool, hashOnRead bs = blockstore.NewBlockstore(rds) bs = &verifbs.VerifBS{Blockstore: bs} - if !nilRepo { + if !nilRepo && (cacheOpts.HasBloomFilterSize > 0 || cacheOpts.HasARCCacheSize > 0) { bs, err = blockstore.CachedBlockstore(helpers.LifecycleCtx(mctx, lc), bs, cacheOpts) if err != nil { return nil, err diff --git a/docs/config.md b/docs/config.md index e0630b40f2b..4039183ff03 100644 --- a/docs/config.md +++ b/docs/config.md @@ -166,6 +166,11 @@ As of writing, [7 hash functions](https://github.com/ipfs/go-ipfs-blockstore/blo Default: `0` +- `ARCCacheSize` +A number representing the number of entries of the blockstore's [ARC cache](https://en.wikipedia.org/wiki/Adaptive_replacement_cache). A value of zero represents the feature being disabled. + +Default: `65536` + - `Spec` Spec defines the structure of the ipfs datastore. It is a composable structure, where each datastore is represented by a json object. Datastores can wrap other datastores to provide extra functionality (eg metrics, logging, or caching).