make db config in lotus-miner actually optional
This commit is contained in:
parent
d82da79e8a
commit
687ad3ae53
@ -787,7 +787,9 @@ func (n *Ensemble) Start() *Ensemble {
|
|||||||
n.t.Cleanup(func() { _ = stop(context.Background()) })
|
n.t.Cleanup(func() { _ = stop(context.Background()) })
|
||||||
mCopy := m
|
mCopy := m
|
||||||
n.t.Cleanup(func() {
|
n.t.Cleanup(func() {
|
||||||
mCopy.BaseAPI.(*impl.StorageMinerAPI).HarmonyDB.ITestDeleteAll()
|
if mCopy.BaseAPI.(*impl.StorageMinerAPI).HarmonyDB != nil {
|
||||||
|
mCopy.BaseAPI.(*impl.StorageMinerAPI).HarmonyDB.ITestDeleteAll()
|
||||||
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
m.BaseAPI = m.StorageMiner
|
m.BaseAPI = m.StorageMiner
|
||||||
|
@ -104,9 +104,6 @@ func ConfigStorageMiner(c interface{}) Option {
|
|||||||
If(cfg.Subsystems.EnableSectorStorage, Error(xerrors.Errorf("sealing can only be enabled on a mining node"))),
|
If(cfg.Subsystems.EnableSectorStorage, Error(xerrors.Errorf("sealing can only be enabled on a mining node"))),
|
||||||
),
|
),
|
||||||
|
|
||||||
Override(new(*harmonydb.DB), func(cfg config.HarmonyDB, id harmonydb.ITestID) (*harmonydb.DB, error) {
|
|
||||||
return harmonydb.NewFromConfigWithITestID(cfg)(id)
|
|
||||||
}),
|
|
||||||
If(cfg.Subsystems.EnableMining,
|
If(cfg.Subsystems.EnableMining,
|
||||||
If(!cfg.Subsystems.EnableSealing, Error(xerrors.Errorf("sealing can't be disabled on a mining node yet"))),
|
If(!cfg.Subsystems.EnableSealing, Error(xerrors.Errorf("sealing can't be disabled on a mining node yet"))),
|
||||||
If(!cfg.Subsystems.EnableSectorStorage, Error(xerrors.Errorf("sealing can't be disabled on a mining node yet"))),
|
If(!cfg.Subsystems.EnableSectorStorage, Error(xerrors.Errorf("sealing can't be disabled on a mining node yet"))),
|
||||||
@ -139,6 +136,11 @@ func ConfigStorageMiner(c interface{}) Option {
|
|||||||
If(cfg.Subsystems.EnableSectorIndexDB,
|
If(cfg.Subsystems.EnableSectorIndexDB,
|
||||||
Override(new(*paths.DBIndex), paths.NewDBIndex),
|
Override(new(*paths.DBIndex), paths.NewDBIndex),
|
||||||
Override(new(paths.SectorIndex), From(new(*paths.DBIndex))),
|
Override(new(paths.SectorIndex), From(new(*paths.DBIndex))),
|
||||||
|
|
||||||
|
// sector index db is the only thing on lotus-miner that will use harmonydb
|
||||||
|
Override(new(*harmonydb.DB), func(cfg config.HarmonyDB, id harmonydb.ITestID) (*harmonydb.DB, error) {
|
||||||
|
return harmonydb.NewFromConfigWithITestID(cfg)(id)
|
||||||
|
}),
|
||||||
),
|
),
|
||||||
If(!cfg.Subsystems.EnableSectorIndexDB,
|
If(!cfg.Subsystems.EnableSectorIndexDB,
|
||||||
Override(new(*paths.MemIndex), paths.NewMemIndex),
|
Override(new(*paths.MemIndex), paths.NewMemIndex),
|
||||||
|
@ -124,7 +124,7 @@ type StorageMinerAPI struct {
|
|||||||
GetExpectedSealDurationFunc dtypes.GetExpectedSealDurationFunc `optional:"true"`
|
GetExpectedSealDurationFunc dtypes.GetExpectedSealDurationFunc `optional:"true"`
|
||||||
SetExpectedSealDurationFunc dtypes.SetExpectedSealDurationFunc `optional:"true"`
|
SetExpectedSealDurationFunc dtypes.SetExpectedSealDurationFunc `optional:"true"`
|
||||||
|
|
||||||
HarmonyDB *harmonydb.DB
|
HarmonyDB *harmonydb.DB `optional:"true"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ api.StorageMiner = &StorageMinerAPI{}
|
var _ api.StorageMiner = &StorageMinerAPI{}
|
||||||
|
Loading…
Reference in New Issue
Block a user