implement Info in splitstore

This commit is contained in:
vyzo 2021-07-26 08:45:46 +03:00
parent 30e4b405b7
commit ce528a1293

View File

@ -9,8 +9,10 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/types"
cid "github.com/ipfs/go-cid"
bstore "github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/chain/types"
)
// performs an asynchronous health-check on the splitstore; results are appended to
@ -126,3 +128,23 @@ func (s *SplitStore) doCheck(curTs *types.TipSet) error {
return nil
}
// provides some basic information about the splitstore
func (s *SplitStore) Info() map[string]interface{} {
info := make(map[string]interface{})
info["base epoch"] = s.baseEpoch
info["warmup epoch"] = s.warmupEpoch
info["compactions"] = s.compactionIndex
sizer, ok := s.hot.(bstore.BlockstoreSize)
if ok {
size, err := sizer.Size()
if err != nil {
log.Warnf("error getting hotstore size: %s", err)
} else {
info["hotstore size"] = size
}
}
return info
}