ledisdb/cmd/repair.go

36 lines
536 B
Go
Raw Permalink Normal View History

package cmd
import (
"flag"
2023-02-15 10:41:45 +03:00
"git.internal/re/ledisdb/config"
"git.internal/re/ledisdb/store"
)
func Repair() {
var fileName = flag.String("config", "", "ledisdb config file")
flag.Parse()
if len(*fileName) == 0 {
println("need ledis config file")
return
}
cfg, err := config.NewConfigWithFile(*fileName)
if err != nil {
println(err.Error())
return
}
if len(cfg.DataDir) == 0 {
println("must set data dir")
return
}
if err = store.Repair(cfg); err != nil {
println("repair error: ", err.Error())
}
}