add ChainCheckBlockstore API

This commit is contained in:
vyzo
2021-07-25 11:14:48 +03:00
parent 1918ffda4e
commit 3d2ae433ee
2 changed files with 16 additions and 0 deletions
+12
View File
@@ -83,6 +83,9 @@ type ChainAPI struct {
// expose externally. In the future, this will be segregated into two
// blockstores.
ExposedBlockstore dtypes.ExposedBlockstore
// BaseBlockstore is the underyling blockstore
BaseBlockstore dtypes.BaseBlockstore
}
func (m *ChainModule) ChainNotify(ctx context.Context) (<-chan []*api.HeadChange, error) {
@@ -644,3 +647,12 @@ func (a *ChainAPI) ChainExport(ctx context.Context, nroots abi.ChainEpoch, skipo
return out, nil
}
func (a *ChainAPI) ChainCheckBlockstore(ctx context.Context) error {
checker, ok := a.BaseBlockstore.(interface{ Check() error })
if !ok {
return xerrors.Errorf("underlying blockstore does not support health checks")
}
return checker.Check()
}