2014-06-26 07:04:54 +04:00
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
2014-08-07 12:49:48 +04: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
|
|
|
)
|
|
|
|
|
2014-08-07 12:49:48 +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
|
|
|
|
}
|
|
|
|
|
2014-08-07 12:49:48 +04:00
|
|
|
cfg, err := config.NewConfigWithFile(*fileName)
|
2014-06-26 07:04:54 +04:00
|
|
|
|
2014-08-07 12:49:48 +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
|
|
|
|
}
|
|
|
|
|
2014-08-07 12:49:48 +04:00
|
|
|
if err = store.Repair(cfg); err != nil {
|
2014-06-26 07:04:54 +04:00
|
|
|
println("repair error: ", err.Error())
|
|
|
|
}
|
|
|
|
}
|