ledisdb/cmd/ledis-repair/main.go

36 lines
540 B
Go
Raw Normal View History

2014-06-26 07:04:54 +04:00
package main
import (
"flag"
2015-05-04 17:42:28 +03:00
2020-04-24 09:10:03 +03:00
"github.com/ledisdb/ledisdb/config"
"github.com/ledisdb/ledisdb/store"
2014-06-26 07:04:54 +04:00
)
var fileName = flag.String("config", "", "ledisdb config file")
2014-06-26 07:04:54 +04:00
func main() {
flag.Parse()
2014-06-27 07:48:14 +04:00
if len(*fileName) == 0 {
println("need ledis config file")
return
}
cfg, err := config.NewConfigWithFile(*fileName)
2014-06-26 07:04:54 +04:00
if err != nil {
2014-06-26 07:04:54 +04:00
println(err.Error())
return
}
if len(cfg.DataDir) == 0 {
println("must set data dir")
return
}
if err = store.Repair(cfg); err != nil {
2014-06-26 07:04:54 +04:00
println("repair error: ", err.Error())
}
}