ledisdb/cmd/ledis-repair/main.go

35 lines
545 B
Go
Raw Normal View History

2014-06-26 07:04:54 +04:00
package main
import (
"flag"
"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())
}
}