Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(52)

Side by Side Diff: logdog/server/service/service.go

Issue 2626433004: Move "common/config" common types into cfgtypes. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « logdog/server/service/config/config.go ('k') | luci_config/common/cfgtypes/config_set.go » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 service 5 package service
6 6
7 import ( 7 import (
8 "errors" 8 "errors"
9 "flag" 9 "flag"
10 "fmt" 10 "fmt"
11 "net/http" 11 "net/http"
12 "os" 12 "os"
13 "os/signal" 13 "os/signal"
14 "path/filepath" 14 "path/filepath"
15 "runtime/pprof" 15 "runtime/pprof"
16 "sync/atomic" 16 "sync/atomic"
17 "time" 17 "time"
18 18
19 "github.com/luci/luci-go/client/authcli" 19 "github.com/luci/luci-go/client/authcli"
20 "github.com/luci/luci-go/common/auth" 20 "github.com/luci/luci-go/common/auth"
21 luciConfig "github.com/luci/luci-go/common/config"
22 "github.com/luci/luci-go/common/data/caching/proccache" 21 "github.com/luci/luci-go/common/data/caching/proccache"
23 "github.com/luci/luci-go/common/gcloud/gs" 22 "github.com/luci/luci-go/common/gcloud/gs"
24 log "github.com/luci/luci-go/common/logging" 23 log "github.com/luci/luci-go/common/logging"
25 "github.com/luci/luci-go/common/logging/gologger" 24 "github.com/luci/luci-go/common/logging/gologger"
26 "github.com/luci/luci-go/common/tsmon" 25 "github.com/luci/luci-go/common/tsmon"
27 "github.com/luci/luci-go/common/tsmon/target" 26 "github.com/luci/luci-go/common/tsmon/target"
28 "github.com/luci/luci-go/grpc/prpc" 27 "github.com/luci/luci-go/grpc/prpc"
29 "github.com/luci/luci-go/logdog/api/config/svcconfig" 28 "github.com/luci/luci-go/logdog/api/config/svcconfig"
30 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/services/v1" 29 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/services/v1"
31 "github.com/luci/luci-go/logdog/common/storage" 30 "github.com/luci/luci-go/logdog/common/storage"
32 "github.com/luci/luci-go/logdog/common/storage/bigtable" 31 "github.com/luci/luci-go/logdog/common/storage/bigtable"
33 "github.com/luci/luci-go/logdog/server/retryServicesClient" 32 "github.com/luci/luci-go/logdog/server/retryServicesClient"
34 "github.com/luci/luci-go/logdog/server/service/config" 33 "github.com/luci/luci-go/logdog/server/service/config"
34 "github.com/luci/luci-go/luci_config/common/cfgtypes"
35 35
36 "cloud.google.com/go/compute/metadata" 36 "cloud.google.com/go/compute/metadata"
37 "golang.org/x/net/context" 37 "golang.org/x/net/context"
38 "golang.org/x/oauth2" 38 "golang.org/x/oauth2"
39 "google.golang.org/api/option" 39 "google.golang.org/api/option"
40 ) 40 )
41 41
42 var ( 42 var (
43 // ErrInvalidConfig is an error that is returned when the supplied 43 // ErrInvalidConfig is an error that is returned when the supplied
44 // configuration is invalid. 44 // configuration is invalid.
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
340 } 340 }
341 341
342 // Config returns the cached service configuration. 342 // Config returns the cached service configuration.
343 func (s *Service) Config() *svcconfig.Config { 343 func (s *Service) Config() *svcconfig.Config {
344 return s.config.Config() 344 return s.config.Config()
345 } 345 }
346 346
347 // ProjectConfig returns the cached project configuration. 347 // ProjectConfig returns the cached project configuration.
348 // 348 //
349 // If the project configuration is not available, nil will be returned. 349 // If the project configuration is not available, nil will be returned.
350 func (s *Service) ProjectConfig(c context.Context, proj luciConfig.ProjectName) (*svcconfig.ProjectConfig, error) { 350 func (s *Service) ProjectConfig(c context.Context, proj cfgtypes.ProjectName) (* svcconfig.ProjectConfig, error) {
351 return s.config.ProjectConfig(c, proj) 351 return s.config.ProjectConfig(c, proj)
352 } 352 }
353 353
354 // Coordinator returns the cached Coordinator client. 354 // Coordinator returns the cached Coordinator client.
355 func (s *Service) Coordinator() logdog.ServicesClient { 355 func (s *Service) Coordinator() logdog.ServicesClient {
356 return s.coord 356 return s.coord
357 } 357 }
358 358
359 // ServiceID returns the service ID. 359 // ServiceID returns the service ID.
360 // 360 //
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 // 469 //
470 // An optional permutation function can be provided to modify those Options 470 // An optional permutation function can be provided to modify those Options
471 // before the Authenticator is created. 471 // before the Authenticator is created.
472 func (s *Service) TokenSource(c context.Context, f func(o *auth.Options)) (oauth 2.TokenSource, error) { 472 func (s *Service) TokenSource(c context.Context, f func(o *auth.Options)) (oauth 2.TokenSource, error) {
473 a, err := s.Authenticator(c, f) 473 a, err := s.Authenticator(c, f)
474 if err != nil { 474 if err != nil {
475 return nil, err 475 return nil, err
476 } 476 }
477 return a.TokenSource() 477 return a.TokenSource()
478 } 478 }
OLDNEW
« no previous file with comments | « logdog/server/service/config/config.go ('k') | luci_config/common/cfgtypes/config_set.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698