From ce528a12930c337f5a0bdf55844a0206bf0ba2d5 Mon Sep 17 00:00:00 2001 From: vyzo Date: Mon, 26 Jul 2021 08:45:46 +0300 Subject: [PATCH] implement Info in splitstore --- blockstore/splitstore/splitstore_check.go | 24 ++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/blockstore/splitstore/splitstore_check.go b/blockstore/splitstore/splitstore_check.go index 43834e87e..8c38b07e9 100644 --- a/blockstore/splitstore/splitstore_check.go +++ b/blockstore/splitstore/splitstore_check.go @@ -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 +}