Add a command to inspect sync state progress

This commit is contained in:
whyrusleeping
2019-09-30 15:06:47 -06:00
parent d692591411
commit af18cbac53
8 changed files with 186 additions and 0 deletions
+11
View File
@@ -57,6 +57,9 @@ type FullNode interface {
ChainGetBlockReceipts(context.Context, cid.Cid) ([]*types.MessageReceipt, error)
ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet) (*types.TipSet, error)
// syncer
SyncState(context.Context) (*SyncState, error)
// messages
MpoolPending(context.Context, *types.TipSet) ([]*types.SignedMessage, error)
@@ -292,3 +295,11 @@ type ReplayResults struct {
Receipt *types.MessageReceipt
Error string
}
type SyncState struct {
Base *types.TipSet
Target *types.TipSet
Stage int
Height uint64
}
+6
View File
@@ -47,6 +47,8 @@ type FullNodeStruct struct {
ChainGetBlockReceipts func(context.Context, cid.Cid) ([]*types.MessageReceipt, error) `perm:"read"`
ChainGetTipSetByHeight func(context.Context, uint64, *types.TipSet) (*types.TipSet, error) `perm:"read"`
SyncState func(context.Context) (*SyncState, error) `perm:"read"`
MpoolPending func(context.Context, *types.TipSet) ([]*types.SignedMessage, error) `perm:"read"`
MpoolPush func(context.Context, *types.SignedMessage) error `perm:"write"`
MpoolPushMessage func(context.Context, *types.Message) (*types.SignedMessage, error) `perm:"sign"`
@@ -284,6 +286,10 @@ func (c *FullNodeStruct) ChainNotify(ctx context.Context) (<-chan []*store.HeadC
return c.Internal.ChainNotify(ctx)
}
func (c *FullNodeStruct) SyncState(ctx context.Context) (*SyncState, error) {
return c.Internal.SyncState(ctx)
}
func (c *FullNodeStruct) StateMinerSectors(ctx context.Context, addr address.Address) ([]*SectorInfo, error) {
return c.Internal.StateMinerSectors(ctx, addr)
}