make badger readonly when initializing storage miner from sector set

This commit is contained in:
whyrusleeping 2019-12-09 14:05:09 -08:00
parent 852415ce04
commit 8fdece1b3f
2 changed files with 8 additions and 2 deletions

View File

@ -81,6 +81,10 @@ var preSealCmd = &cli.Command{
Value: 0,
Usage: "how many sector ids to skip when starting to seal",
},
&cli.StringFlag{
Name: "sectorbuilder-dir",
Value: "~/.genesis-sectors",
},
},
Action: func(c *cli.Context) error {
sdir := c.String("sectorbuilder-dir")
@ -179,7 +183,7 @@ var aggregateSectorDirsCmd = &cli.Command{
return err
}
if err := os.MkdirAll(cctx.String("dest"), 0755); err != nil {
if err := os.MkdirAll(destdir, 0755); err != nil {
return err
}

View File

@ -153,7 +153,9 @@ var initCmd = &cli.Command{
return err
}
oldmds, err := badger.NewDatastore(filepath.Join(pssb, "badger"), nil)
bopts := badger.DefaultOptions
bopts.ReadOnly = true
oldmds, err := badger.NewDatastore(filepath.Join(pssb, "badger"), &bopts)
if err != nil {
return err
}