cli: remove --skip
parameter from restore
It isn't really a parameter and it's value can be deduced automatically. Signed-off-by: Evgeniy Stratonikov <evgeniy@nspcc.ru>
This commit is contained in:
parent
df5ee4abdc
commit
de15d42861
3 changed files with 12 additions and 12 deletions
|
@ -52,10 +52,6 @@ func NewCommands() []cli.Command {
|
|||
var cfgCountInFlags = make([]cli.Flag, len(cfgWithCountFlags))
|
||||
copy(cfgCountInFlags, cfgWithCountFlags)
|
||||
cfgCountInFlags = append(cfgCountInFlags,
|
||||
cli.UintFlag{
|
||||
Name: "skip, s",
|
||||
Usage: "number of blocks to skip (default: 0)",
|
||||
},
|
||||
cli.StringFlag{
|
||||
Name: "in, i",
|
||||
Usage: "Input file (stdin if not given)",
|
||||
|
@ -219,7 +215,6 @@ func restoreDB(ctx *cli.Context) error {
|
|||
return cli.NewExitError(err, 1)
|
||||
}
|
||||
count := uint32(ctx.Uint("count"))
|
||||
skip := uint32(ctx.Uint("skip"))
|
||||
|
||||
var inStream = os.Stdin
|
||||
if in := ctx.String("in"); in != "" {
|
||||
|
@ -251,6 +246,10 @@ func restoreDB(ctx *cli.Context) error {
|
|||
return cli.NewExitError(fmt.Errorf("expected height: %d, dump starts at %d",
|
||||
chain.BlockHeight()+1, start), 1)
|
||||
}
|
||||
}
|
||||
|
||||
var skip uint32
|
||||
if chain.BlockHeight() != 0 {
|
||||
skip = chain.BlockHeight() + 1 - start
|
||||
}
|
||||
|
||||
|
@ -264,6 +263,11 @@ func restoreDB(ctx *cli.Context) error {
|
|||
if count == 0 {
|
||||
count = allBlocks - skip
|
||||
}
|
||||
log.Info("initialize restore",
|
||||
zap.Uint32("start", start),
|
||||
zap.Uint32("height", chain.BlockHeight()),
|
||||
zap.Uint32("skip", skip),
|
||||
zap.Uint32("count", count))
|
||||
|
||||
gctx := newGraceContext()
|
||||
var lastIndex uint32
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue