//设置redis-cli和同步后rdb文件的位置 func init() { conf := config.SetConfig("important.properties") cliLocation = conf.GetValue("param", "cli_location") rdbLocation = conf.GetValue("param", "rdb_location") port = conf.GetValue("port", "port") multiply, _ = strconv.ParseInt(conf.GetValue("timeout", "multiply"), 10, 32) }
/** 这个是解析的入口 pwflag 表示是打印还是写入到文件 0 打印 1 写入到文件 2 写入到数据库 filename 表示要解析的文件路径 */ func Start(inputFile string, filterLength int, filterKey string) Parameters { //读取管道的大小 conf := config.SetConfig("important.properties") sliceContent, _ := strconv.ParseUint(conf.GetValue("pipeline", "size"), 10, 64) if sliceContent < 16 { sliceContent = 16 logs.Log("sliceContent < 16") } var heapIni bool = false var param Parameters param.Success = false param.SliceStart = 0 param.SliceEnd = 0 param.Step = []uint64{5, 4} param.FileFlag = false param.SliceContent = sliceContent param.FixedInfo = false param.OffsetBytes = 0 param.Dbnum = -1 param.ResultMap = make(map[string]int) param.ValueFilterLength = filterLength param.FilterKey = filterKey param.ValueLengthFilterList = list.New() param.KeyFilterMap = make(map[string]int) param.Heap = &sorting.Heap{} param.HeapInit = &heapIni pipelineAnalyze(inputFile, ¶m) return param }
func init() { conf := config.SetConfig("important.properties") connection := conf.GetValue("database", "connection") db, _ = sql.Open("mysql", connection) db.SetMaxOpenConns(200) db.SetMaxIdleConns(100) db.Ping() }
func init() { conf := config.SetConfig("important.properties") logLocation := conf.GetValue("log", "log_location") logFile, err := os.OpenFile(logLocation, os.O_CREATE|os.O_APPEND|os.O_RDWR, 0664) if err != nil { fmt.Println("in logger : " + err.Error()) os.Exit(-1) } logger = log.New(logFile, "n", log.Ldate|log.Ltime|log.Llongfile) }