Storage groups units which setup datastore based persistence and blockstore layers
(bcfg *BuildCfg, cfg *config.Config)
| 235 | |
| 236 | // Storage groups units which setup datastore based persistence and blockstore layers |
| 237 | func 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 |
| 266 | func Identity(cfg *config.Config) fx.Option { |
no test coverage detected