2020-12-07 20:36:43 +00:00
|
|
|
package db
|
|
|
|
|
|
|
|
import (
|
2022-08-16 12:20:13 +00:00
|
|
|
beacondb "github.com/prysmaticlabs/prysm/v3/beacon-chain/db"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/cmd"
|
|
|
|
"github.com/prysmaticlabs/prysm/v3/runtime/tos"
|
2021-03-03 17:05:37 +00:00
|
|
|
"github.com/sirupsen/logrus"
|
2020-12-07 20:36:43 +00:00
|
|
|
"github.com/urfave/cli/v2"
|
|
|
|
)
|
|
|
|
|
2021-03-03 17:05:37 +00:00
|
|
|
var log = logrus.WithField("prefix", "db")
|
|
|
|
|
|
|
|
// Commands for interacting with a beacon chain database.
|
|
|
|
var Commands = &cli.Command{
|
2020-12-07 20:36:43 +00:00
|
|
|
Name: "db",
|
|
|
|
Category: "db",
|
2021-06-26 19:00:33 +00:00
|
|
|
Usage: "defines commands for interacting with the Ethereum Beacon Node database",
|
2020-12-07 20:36:43 +00:00
|
|
|
Subcommands: []*cli.Command{
|
|
|
|
{
|
|
|
|
Name: "restore",
|
|
|
|
Description: `restores a database from a backup file`,
|
|
|
|
Flags: cmd.WrapFlags([]cli.Flag{
|
|
|
|
cmd.RestoreSourceFileFlag,
|
|
|
|
cmd.RestoreTargetDirFlag,
|
|
|
|
}),
|
|
|
|
Before: tos.VerifyTosAcceptedOrPrompt,
|
|
|
|
Action: func(cliCtx *cli.Context) error {
|
2021-03-03 17:05:37 +00:00
|
|
|
if err := beacondb.Restore(cliCtx); err != nil {
|
2022-08-05 10:52:02 +00:00
|
|
|
log.WithError(err).Fatal("Could not restore database")
|
2020-12-07 20:36:43 +00:00
|
|
|
}
|
|
|
|
return nil
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
|
|
|
}
|