ledisdb/cmd/ledis-repair/main.go

36 lines
546 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
"github.com/siddontang/ledisdb/config"
2014-07-25 13:58:00 +04:00
"github.com/siddontang/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())
}
}