Merge pull request #6003 from filecoin-project/fix/fbs-di
Fix fallback chainstore
This commit is contained in:
commit
88bdb591d5
@ -612,18 +612,21 @@ func Repo(r repo.Repo) Option {
|
|||||||
If(cfg.Splitstore.HotStoreType == "badger",
|
If(cfg.Splitstore.HotStoreType == "badger",
|
||||||
Override(new(dtypes.HotBlockstore), modules.BadgerHotBlockstore)),
|
Override(new(dtypes.HotBlockstore), modules.BadgerHotBlockstore)),
|
||||||
Override(new(dtypes.SplitBlockstore), modules.SplitBlockstore(cfg)),
|
Override(new(dtypes.SplitBlockstore), modules.SplitBlockstore(cfg)),
|
||||||
Override(new(dtypes.ChainBlockstore), modules.ChainSplitBlockstore),
|
Override(new(dtypes.BasicChainBlockstore), modules.ChainSplitBlockstore),
|
||||||
Override(new(dtypes.StateBlockstore), modules.StateSplitBlockstore),
|
Override(new(dtypes.BasicStateBlockstore), modules.StateSplitBlockstore),
|
||||||
Override(new(dtypes.BaseBlockstore), From(new(dtypes.SplitBlockstore))),
|
Override(new(dtypes.BaseBlockstore), From(new(dtypes.SplitBlockstore))),
|
||||||
Override(new(dtypes.ExposedBlockstore), From(new(dtypes.SplitBlockstore))),
|
Override(new(dtypes.ExposedBlockstore), From(new(dtypes.SplitBlockstore))),
|
||||||
),
|
),
|
||||||
If(!cfg.EnableSplitstore,
|
If(!cfg.EnableSplitstore,
|
||||||
Override(new(dtypes.ChainBlockstore), modules.ChainFlatBlockstore),
|
Override(new(dtypes.BasicChainBlockstore), modules.ChainFlatBlockstore),
|
||||||
Override(new(dtypes.StateBlockstore), modules.StateFlatBlockstore),
|
Override(new(dtypes.BasicStateBlockstore), modules.StateFlatBlockstore),
|
||||||
Override(new(dtypes.BaseBlockstore), From(new(dtypes.UniversalBlockstore))),
|
Override(new(dtypes.BaseBlockstore), From(new(dtypes.UniversalBlockstore))),
|
||||||
Override(new(dtypes.ExposedBlockstore), From(new(dtypes.UniversalBlockstore))),
|
Override(new(dtypes.ExposedBlockstore), From(new(dtypes.UniversalBlockstore))),
|
||||||
),
|
),
|
||||||
|
|
||||||
|
Override(new(dtypes.ChainBlockstore), From(new(dtypes.BasicChainBlockstore))),
|
||||||
|
Override(new(dtypes.StateBlockstore), From(new(dtypes.BasicStateBlockstore))),
|
||||||
|
|
||||||
If(os.Getenv("LOTUS_ENABLE_CHAINSTORE_FALLBACK") == "1",
|
If(os.Getenv("LOTUS_ENABLE_CHAINSTORE_FALLBACK") == "1",
|
||||||
Override(new(dtypes.ChainBlockstore), modules.FallbackChainBlockstore),
|
Override(new(dtypes.ChainBlockstore), modules.FallbackChainBlockstore),
|
||||||
Override(new(dtypes.StateBlockstore), modules.FallbackStateBlockstore),
|
Override(new(dtypes.StateBlockstore), modules.FallbackStateBlockstore),
|
||||||
|
@ -94,11 +94,11 @@ func SplitBlockstore(cfg *config.Chainstore) func(lc fx.Lifecycle, r repo.Locked
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func StateFlatBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.UniversalBlockstore) (dtypes.StateBlockstore, error) {
|
func StateFlatBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.UniversalBlockstore) (dtypes.BasicStateBlockstore, error) {
|
||||||
return bs, nil
|
return bs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func StateSplitBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.SplitBlockstore) (dtypes.StateBlockstore, error) {
|
func StateSplitBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.SplitBlockstore) (dtypes.BasicStateBlockstore, error) {
|
||||||
return bs, nil
|
return bs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,11 +110,11 @@ func ChainSplitBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.SplitB
|
|||||||
return bs, nil
|
return bs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func FallbackChainBlockstore(cbs dtypes.ChainBlockstore) dtypes.ChainBlockstore {
|
func FallbackChainBlockstore(cbs dtypes.BasicChainBlockstore) dtypes.ChainBlockstore {
|
||||||
return &blockstore.FallbackStore{Blockstore: cbs}
|
return &blockstore.FallbackStore{Blockstore: cbs}
|
||||||
}
|
}
|
||||||
|
|
||||||
func FallbackStateBlockstore(sbs dtypes.StateBlockstore) dtypes.StateBlockstore {
|
func FallbackStateBlockstore(sbs dtypes.BasicStateBlockstore) dtypes.StateBlockstore {
|
||||||
return &blockstore.FallbackStore{Blockstore: sbs}
|
return &blockstore.FallbackStore{Blockstore: sbs}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -36,12 +36,20 @@ type (
|
|||||||
// BaseBlockstore is something, coz DI
|
// BaseBlockstore is something, coz DI
|
||||||
BaseBlockstore blockstore.Blockstore
|
BaseBlockstore blockstore.Blockstore
|
||||||
|
|
||||||
|
// BasicChainBlockstore is like ChainBlockstore, but without the optional
|
||||||
|
// network fallback support
|
||||||
|
BasicChainBlockstore blockstore.Blockstore
|
||||||
|
|
||||||
// ChainBlockstore is a blockstore to store chain data (tipsets, blocks,
|
// ChainBlockstore is a blockstore to store chain data (tipsets, blocks,
|
||||||
// messages). It is physically backed by the BareMonolithBlockstore, but it
|
// messages). It is physically backed by the BareMonolithBlockstore, but it
|
||||||
// has a cache on top that is specially tuned for chain data access
|
// has a cache on top that is specially tuned for chain data access
|
||||||
// patterns.
|
// patterns.
|
||||||
ChainBlockstore blockstore.Blockstore
|
ChainBlockstore blockstore.Blockstore
|
||||||
|
|
||||||
|
// BasicStateBlockstore is like StateBlockstore, but without the optional
|
||||||
|
// network fallback support
|
||||||
|
BasicStateBlockstore blockstore.Blockstore
|
||||||
|
|
||||||
// StateBlockstore is a blockstore to store state data (state tree). It is
|
// StateBlockstore is a blockstore to store state data (state tree). It is
|
||||||
// physically backed by the BareMonolithBlockstore, but it has a cache on
|
// physically backed by the BareMonolithBlockstore, but it has a cache on
|
||||||
// top that is specially tuned for state data access patterns.
|
// top that is specially tuned for state data access patterns.
|
||||||
|
Loading…
Reference in New Issue
Block a user