-
Notifications
You must be signed in to change notification settings - Fork 46
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor: simplify job cli #944
Changes from all commits
799b6a9
051fc5e
4928cad
3a95eb7
c23834c
d058508
d6cec2a
775b1e5
e3f12d6
c96cf1f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,12 +16,12 @@ type Finder struct { | |
DB *storage.Database | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes here due to unify range flags (--to and --from) to use int64's. mechanical change |
||
node lens.API | ||
name string | ||
minHeight, maxHeight uint64 | ||
minHeight, maxHeight int64 | ||
tasks []string | ||
done chan struct{} | ||
} | ||
|
||
func NewFinder(node lens.API, db *storage.Database, name string, minHeight, maxHeight uint64, tasks []string) *Finder { | ||
func NewFinder(node lens.API, db *storage.Database, name string, minHeight, maxHeight int64, tasks []string) *Finder { | ||
return &Finder{ | ||
DB: db, | ||
node: node, | ||
|
@@ -89,7 +89,7 @@ func (g *Finder) Run(ctx context.Context) error { | |
if err != nil { | ||
return err | ||
} | ||
if uint64(head.Height()) < g.maxHeight { | ||
if int64(head.Height()) < g.maxHeight { | ||
return xerrors.Errorf("cannot look for gaps beyond chain head height %d", head.Height()) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,8 +19,8 @@ import ( | |
) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes here due to unify range flags (--to and --from) to use int64's. mechanical change |
||
|
||
var ( | ||
minHeight = uint64(0) | ||
maxHeight = uint64(10) | ||
minHeight = int64(0) | ||
maxHeight = int64(10) | ||
) | ||
|
||
func TestFind(t *testing.T) { | ||
|
@@ -459,7 +459,7 @@ func (e *PREditor) truncate() { | |
require.NoError(e.t, err, "visor_processing_report") | ||
} | ||
|
||
func (e *PREditor) initialize(count uint64, tasks ...string) { | ||
func (e *PREditor) initialize(count int64, tasks ...string) { | ||
// build the task array | ||
// uncomment to see all query | ||
// db.AddQueryHook(&LoggingQueryHook{}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,12 +18,12 @@ type Notifier struct { | |
queue *queue.AsynQ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. changes here due to unify range flags (--to and --from) to use int64's. mechanical change |
||
node lens.API | ||
name string | ||
minHeight, maxHeight uint64 | ||
minHeight, maxHeight int64 | ||
tasks []string | ||
done chan struct{} | ||
} | ||
|
||
func NewNotifier(node lens.API, db *storage.Database, queue *queue.AsynQ, name string, minHeight, maxHeight uint64, tasks []string) *Notifier { | ||
func NewNotifier(node lens.API, db *storage.Database, queue *queue.AsynQ, name string, minHeight, maxHeight int64, tasks []string) *Notifier { | ||
return &Notifier{ | ||
DB: db, | ||
queue: queue, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,14 +9,15 @@ import ( | |
|
||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. mechanical changes to remove client flags |
||
"github.com/filecoin-project/go-state-types/abi" | ||
"github.com/filecoin-project/go-state-types/big" | ||
"github.com/filecoin-project/lily/lens/lily" | ||
"github.com/filecoin-project/lotus/api" | ||
lotusbuild "github.com/filecoin-project/lotus/build" | ||
"github.com/filecoin-project/lotus/chain/types" | ||
lotuscli "github.com/filecoin-project/lotus/cli" | ||
"github.com/ipfs/go-cid" | ||
"github.com/urfave/cli/v2" | ||
"golang.org/x/xerrors" | ||
|
||
"github.com/filecoin-project/lily/lens/lily" | ||
) | ||
|
||
var ChainCmd = &cli.Command{ | ||
|
@@ -36,12 +37,9 @@ var ChainCmd = &cli.Command{ | |
var ChainHeadCmd = &cli.Command{ | ||
Name: "head", | ||
Usage: "Print chain head", | ||
Flags: flagSet( | ||
clientAPIFlagSet, | ||
), | ||
Action: func(cctx *cli.Context) error { | ||
ctx := lotuscli.ReqContext(cctx) | ||
lapi, closer, err := GetAPI(ctx, clientAPIFlags.apiAddr, clientAPIFlags.apiToken) | ||
lapi, closer, err := GetAPI(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -63,17 +61,15 @@ var ChainGetBlock = &cli.Command{ | |
Name: "getblock", | ||
Usage: "Get a block and print its details", | ||
ArgsUsage: "[blockCid]", | ||
Flags: flagSet( | ||
clientAPIFlagSet, | ||
[]cli.Flag{ | ||
&cli.BoolFlag{ | ||
Name: "raw", | ||
Usage: "print just the raw block header", | ||
}, | ||
}), | ||
Flags: []cli.Flag{ | ||
&cli.BoolFlag{ | ||
Name: "raw", | ||
Usage: "print just the raw block header", | ||
}, | ||
}, | ||
Action: func(cctx *cli.Context) error { | ||
ctx := lotuscli.ReqContext(cctx) | ||
lapi, closer, err := GetAPI(ctx, clientAPIFlags.apiAddr, clientAPIFlags.apiToken) | ||
lapi, closer, err := GetAPI(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -155,12 +151,9 @@ var ChainReadObjCmd = &cli.Command{ | |
Name: "read-obj", | ||
Usage: "Read the raw bytes of an object", | ||
ArgsUsage: "[objectCid]", | ||
Flags: flagSet( | ||
clientAPIFlagSet, | ||
), | ||
Action: func(cctx *cli.Context) error { | ||
ctx := lotuscli.ReqContext(cctx) | ||
lapi, closer, err := GetAPI(ctx, clientAPIFlags.apiAddr, clientAPIFlags.apiToken) | ||
lapi, closer, err := GetAPI(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -190,17 +183,15 @@ var ChainStatObjCmd = &cli.Command{ | |
When a base is provided it will be walked first, and all links visisted | ||
will be ignored when the passed in object is walked. | ||
`, | ||
Flags: flagSet( | ||
clientAPIFlagSet, | ||
[]cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "base", | ||
Usage: "ignore links found in this obj", | ||
}, | ||
}), | ||
Flags: []cli.Flag{ | ||
&cli.StringFlag{ | ||
Name: "base", | ||
Usage: "ignore links found in this obj", | ||
}, | ||
}, | ||
Action: func(cctx *cli.Context) error { | ||
ctx := lotuscli.ReqContext(cctx) | ||
lapi, closer, err := GetAPI(ctx, clientAPIFlags.apiAddr, clientAPIFlags.apiToken) | ||
lapi, closer, err := GetAPI(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -240,7 +231,7 @@ var ChainGetMsgCmd = &cli.Command{ | |
} | ||
|
||
ctx := lotuscli.ReqContext(cctx) | ||
lapi, closer, err := GetAPI(ctx, clientAPIFlags.apiAddr, clientAPIFlags.apiToken) | ||
lapi, closer, err := GetAPI(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -282,24 +273,22 @@ var ChainListCmd = &cli.Command{ | |
Name: "list", | ||
Aliases: []string{"love"}, | ||
Usage: "View a segment of the chain", | ||
Flags: flagSet( | ||
clientAPIFlagSet, | ||
[]cli.Flag{ | ||
&cli.Uint64Flag{Name: "height", DefaultText: "current head"}, | ||
&cli.IntFlag{Name: "count", Value: 30}, | ||
&cli.StringFlag{ | ||
Name: "format", | ||
Usage: "specify the format to print out tipsets", | ||
Value: "<height>: (<time>) <blocks>", | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "gas-stats", | ||
Usage: "view gas statistics for the chain", | ||
}, | ||
}), | ||
Flags: []cli.Flag{ | ||
&cli.Uint64Flag{Name: "height", DefaultText: "current head"}, | ||
&cli.IntFlag{Name: "count", Value: 30}, | ||
&cli.StringFlag{ | ||
Name: "format", | ||
Usage: "specify the format to print out tipsets", | ||
Value: "<height>: (<time>) <blocks>", | ||
}, | ||
&cli.BoolFlag{ | ||
Name: "gas-stats", | ||
Usage: "view gas statistics for the chain", | ||
}, | ||
}, | ||
Action: func(cctx *cli.Context) error { | ||
ctx := lotuscli.ReqContext(cctx) | ||
lapi, closer, err := GetAPI(ctx, clientAPIFlags.apiAddr, clientAPIFlags.apiToken) | ||
lapi, closer, err := GetAPI(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
@@ -413,21 +402,19 @@ var ChainSetHeadCmd = &cli.Command{ | |
Name: "sethead", | ||
Usage: "manually set the local nodes head tipset (Caution: normally only used for recovery)", | ||
ArgsUsage: "[tipsetkey]", | ||
Flags: flagSet( | ||
clientAPIFlagSet, | ||
[]cli.Flag{ | ||
&cli.BoolFlag{ | ||
Name: "genesis", | ||
Usage: "reset head to genesis", | ||
}, | ||
&cli.Uint64Flag{ | ||
Name: "epoch", | ||
Usage: "reset head to given epoch", | ||
}, | ||
}), | ||
Flags: []cli.Flag{ | ||
&cli.BoolFlag{ | ||
Name: "genesis", | ||
Usage: "reset head to genesis", | ||
}, | ||
&cli.Uint64Flag{ | ||
Name: "epoch", | ||
Usage: "reset head to given epoch", | ||
}, | ||
}, | ||
Action: func(cctx *cli.Context) error { | ||
ctx := lotuscli.ReqContext(cctx) | ||
lapi, closer, err := GetAPI(ctx, clientAPIFlags.apiAddr, clientAPIFlags.apiToken) | ||
lapi, closer, err := GetAPI(ctx) | ||
if err != nil { | ||
return err | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
changes here due to unify range flags (--to and --from) to use int64's. mechanical change