add ChainCheckBlockstore API
This commit is contained in:
parent
1918ffda4e
commit
3d2ae433ee
@ -164,6 +164,10 @@ type FullNode interface {
|
||||
// If oldmsgskip is set, messages from before the requested roots are also not included.
|
||||
ChainExport(ctx context.Context, nroots abi.ChainEpoch, oldmsgskip bool, tsk types.TipSetKey) (<-chan []byte, error) //perm:read
|
||||
|
||||
// ChainCheckBlockstore performs an (asynchronous) health check on the chain/state blockstore
|
||||
// if supported by the underlying implementation.
|
||||
ChainCheckBlockstore(context.Context) error
|
||||
|
||||
// MethodGroup: Beacon
|
||||
// The Beacon method group contains methods for interacting with the random beacon (DRAND)
|
||||
|
||||
|
@ -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()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user