MCPcopy
hub / github.com/ipfs/kubo / Storage

Function Storage

core/node/groups.go:237–263  ·  view source on GitHub ↗

Storage groups units which setup datastore based persistence and blockstore layers

(bcfg *BuildCfg, cfg *config.Config)

Source from the content-addressed store, hash-verified

235
236// Storage groups units which setup datastore based persistence and blockstore layers
237func Storage(bcfg *BuildCfg, cfg *config.Config) fx.Option {
238 cacheOpts := blockstore.DefaultCacheOpts()
239 cacheOpts.HasBloomFilterSize = cfg.Datastore.BloomFilterSize
240 cacheOpts.HasTwoQueueCacheSize = int(cfg.Datastore.BlockKeyCacheSize.WithDefault(config.DefaultBlockKeyCacheSize))
241 if !bcfg.Permanent {
242 cacheOpts.HasBloomFilterSize = 0
243 }
244
245 finalBstore := fx.Provide(GcBlockstoreCtor)
246 if cfg.Experimental.FilestoreEnabled || cfg.Experimental.UrlstoreEnabled {
247 finalBstore = fx.Provide(FilestoreBlockstoreCtor(
248 cfg.Provide.Strategy.WithDefault(config.DefaultProvideStrategy),
249 ))
250 }
251
252 return fx.Options(
253 fx.Provide(RepoConfig),
254 fx.Provide(Datastore),
255 fx.Provide(BaseBlockstoreCtor(
256 cacheOpts,
257 cfg.Datastore.HashOnRead,
258 cfg.Datastore.WriteThrough.WithDefault(config.DefaultWriteThrough),
259 cfg.Provide.Strategy.WithDefault(config.DefaultProvideStrategy),
260 )),
261 finalBstore,
262 )
263}
264
265// Identity groups units providing cryptographic identity
266func Identity(cfg *config.Config) fx.Option {

Callers 1

IPFSFunction · 0.85

Calls 5

FilestoreBlockstoreCtorFunction · 0.85
BaseBlockstoreCtorFunction · 0.85
ProvideMethod · 0.65
OptionsMethod · 0.65
WithDefaultMethod · 0.45

Tested by

no test coverage detected