add ChainBlockstoreInfo APIv1 endpoint

This commit is contained in:
vyzo 2021-07-26 08:30:07 +03:00
parent c00b86e8a8
commit a0d6fdba33
2 changed files with 12 additions and 0 deletions

View File

@ -168,6 +168,9 @@ type FullNode interface {
// if supported by the underlying implementation.
ChainCheckBlockstore(context.Context) error //perm:read
// ChainBlockstoreInfo returns some basic information about the blockstore
ChainBlockstoreInfo(context.Context) (map[string]interface{}, error) //perm:read
// MethodGroup: Beacon
// The Beacon method group contains methods for interacting with the random beacon (DRAND)

View File

@ -656,3 +656,12 @@ func (a *ChainAPI) ChainCheckBlockstore(ctx context.Context) error {
return checker.Check()
}
func (a *ChainAPI) ChainBlockstoreInfo(ctx context.Context) (map[string]interface{}, error) {
info, ok := a.BaseBlockstore.(interface{ Info() map[string]interface{} })
if !ok {
return nil, xerrors.Errorf("underlying blockstore does not provide info")
}
return info.Info(), nil
}