MCPcopy Index your code
hub / github.com/CovenantSQL/CovenantSQL / main

Function main

cmd/cql-minerd/main.go:121–301  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

119}
120
121func main() {
122 flag.Parse()
123 // set random
124 rand.Seed(time.Now().UnixNano())
125 log.SetStringLevel(logLevel, log.InfoLevel)
126
127 if showVersion {
128 fmt.Printf("%v %v %v %v %v\n",
129 name, version, runtime.GOOS, runtime.GOARCH, runtime.Version())
130 os.Exit(0)
131 }
132
133 configFile = utils.HomeDirExpand(configFile)
134
135 flag.Visit(func(f *flag.Flag) {
136 log.Infof("args %#v : %s", f.Name, f.Value)
137 })
138
139 var err error
140 conf.GConf, err = conf.LoadConfig(configFile)
141 if err != nil {
142 log.WithField("config", configFile).WithError(err).Fatal("load config failed")
143 }
144
145 if conf.GConf.Miner == nil {
146 log.Fatal("miner config does not exists")
147 }
148 if conf.GConf.Miner.ProvideServiceInterval.Seconds() <= 0 {
149 log.Fatal("miner metric collect interval is invalid")
150 }
151 if conf.GConf.Miner.MaxReqTimeGap.Seconds() <= 0 {
152 log.Fatal("miner request time gap is invalid")
153 }
154 if conf.GConf.Miner.DiskUsageInterval.Seconds() <= 0 {
155 // set to default disk usage interval
156 log.Warning("miner disk usage interval not provided, set to default 10 minutes")
157 conf.GConf.Miner.DiskUsageInterval = time.Minute * 10
158 }
159
160 log.Debugf("config:\n%#v", conf.GConf)
161
162 // init log
163 initLogs()
164
165 if !noLogo {
166 fmt.Print(logo)
167 }
168
169 // init profile, if cpuProfile, memProfile length is 0, nothing will be done
170 _ = utils.StartProfile(cpuProfile, memProfile)
171
172 // set generate key pair config
173 conf.GConf.GenerateKeyPair = genKeyPair
174
175 // start rpc
176 var (
177 server *mux.Server
178 direct *rpc.Server

Callers 1

TestMainFunction · 0.70

Calls 15

ShutdownMethod · 0.95
SetStringLevelFunction · 0.92
HomeDirExpandFunction · 0.92
InfofFunction · 0.92
LoadConfigFunction · 0.92
WithFieldFunction · 0.92
FatalFunction · 0.92
WarningFunction · 0.92
DebugfFunction · 0.92
StartProfileFunction · 0.92
WithErrorFunction · 0.92
PrintlnFunction · 0.92

Tested by 1

TestMainFunction · 0.56