| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package main | 5 package main |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 "time" | 9 "time" |
| 10 | 10 |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 56 distribution.DefaultBucketer) | 56 distribution.DefaultBucketer) |
| 57 ) | 57 ) |
| 58 | 58 |
| 59 // application is the Collector application state. | 59 // application is the Collector application state. |
| 60 type application struct { | 60 type application struct { |
| 61 service.Service | 61 service.Service |
| 62 } | 62 } |
| 63 | 63 |
| 64 // run is the main execution function. | 64 // run is the main execution function. |
| 65 func (a *application) runCollector(c context.Context) error { | 65 func (a *application) runCollector(c context.Context) error { |
| 66 » cfg := a.Config() | 66 » cfg := a.ServiceConfig() |
| 67 ccfg := cfg.GetCollector() | 67 ccfg := cfg.GetCollector() |
| 68 if ccfg == nil { | 68 if ccfg == nil { |
| 69 return errors.New("no collector configuration") | 69 return errors.New("no collector configuration") |
| 70 } | 70 } |
| 71 | 71 |
| 72 pscfg := cfg.GetTransport().GetPubsub() | 72 pscfg := cfg.GetTransport().GetPubsub() |
| 73 if pscfg == nil { | 73 if pscfg == nil { |
| 74 return errors.New("missing Pub/Sub configuration") | 74 return errors.New("missing Pub/Sub configuration") |
| 75 } | 75 } |
| 76 | 76 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 221 | 221 |
| 222 // Entry point. | 222 // Entry point. |
| 223 func main() { | 223 func main() { |
| 224 a := application{ | 224 a := application{ |
| 225 Service: service.Service{ | 225 Service: service.Service{ |
| 226 Name: "collector", | 226 Name: "collector", |
| 227 }, | 227 }, |
| 228 } | 228 } |
| 229 a.Run(context.Background(), a.runCollector) | 229 a.Run(context.Background(), a.runCollector) |
| 230 } | 230 } |
| OLD | NEW |