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

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

Issue 1968063003: LogDog: Use per-project settings for archival. (Closed) Base URL: https://github.com/luci/luci-go@logdog-project-coordinator-useconfig
Patch Set: Created 4 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // 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/api/logdog_coordinator/services/v1" 20 "github.com/luci/luci-go/common/api/logdog_coordinator/services/v1"
21 "github.com/luci/luci-go/common/auth" 21 "github.com/luci/luci-go/common/auth"
22 luciConfig "github.com/luci/luci-go/common/config"
22 "github.com/luci/luci-go/common/gcloud/gs" 23 "github.com/luci/luci-go/common/gcloud/gs"
23 log "github.com/luci/luci-go/common/logging" 24 log "github.com/luci/luci-go/common/logging"
24 "github.com/luci/luci-go/common/logging/gologger" 25 "github.com/luci/luci-go/common/logging/gologger"
25 "github.com/luci/luci-go/common/proto/logdog/svcconfig" 26 "github.com/luci/luci-go/common/proto/logdog/svcconfig"
26 "github.com/luci/luci-go/common/prpc" 27 "github.com/luci/luci-go/common/prpc"
27 "github.com/luci/luci-go/common/tsmon" 28 "github.com/luci/luci-go/common/tsmon"
28 "github.com/luci/luci-go/common/tsmon/metric" 29 "github.com/luci/luci-go/common/tsmon/metric"
29 "github.com/luci/luci-go/common/tsmon/target" 30 "github.com/luci/luci-go/common/tsmon/target"
30 "github.com/luci/luci-go/server/internal/logdog/retryServicesClient" 31 "github.com/luci/luci-go/server/internal/logdog/retryServicesClient"
31 "github.com/luci/luci-go/server/internal/logdog/service/config" 32 "github.com/luci/luci-go/server/internal/logdog/service/config"
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after
302 303
303 func (s *Service) shutdownImmediately() { 304 func (s *Service) shutdownImmediately() {
304 os.Exit(1) 305 os.Exit(1)
305 } 306 }
306 307
307 // Config returns the cached service configuration. 308 // Config returns the cached service configuration.
308 func (s *Service) Config() *svcconfig.Config { 309 func (s *Service) Config() *svcconfig.Config {
309 return s.config.Config() 310 return s.config.Config()
310 } 311 }
311 312
313 // ProjectConfig returns the cached project configuration.
314 //
315 // If the project configuration is not available, nil will be returned.
316 func (s *Service) ProjectConfig(c context.Context, proj luciConfig.ProjectName) (*svcconfig.ProjectConfig, error) {
317 return s.config.ProjectConfig(c, proj)
318 }
319
312 // Coordinator returns the cached Coordinator client. 320 // Coordinator returns the cached Coordinator client.
313 func (s *Service) Coordinator() logdog.ServicesClient { 321 func (s *Service) Coordinator() logdog.ServicesClient {
314 return s.coord 322 return s.coord
315 } 323 }
316 324
317 // IntermediateStorage instantiates the configured intermediate Storage 325 // IntermediateStorage instantiates the configured intermediate Storage
318 // instance. 326 // instance.
319 func (s *Service) IntermediateStorage(c context.Context) (storage.Storage, error ) { 327 func (s *Service) IntermediateStorage(c context.Context) (storage.Storage, error ) {
320 cfg := s.config.Config() 328 cfg := s.config.Config()
321 if cfg.GetStorage() == nil { 329 if cfg.GetStorage() == nil {
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 // 416 //
409 // An optional permutation functon can be provided to modify those Options 417 // An optional permutation functon can be provided to modify those Options
410 // before the Authenticator is created. 418 // before the Authenticator is created.
411 func (s *Service) AuthenticatedClient(c context.Context, f func(o *auth.Options) ) (*http.Client, error) { 419 func (s *Service) AuthenticatedClient(c context.Context, f func(o *auth.Options) ) (*http.Client, error) {
412 a, err := s.Authenticator(c, f) 420 a, err := s.Authenticator(c, f)
413 if err != nil { 421 if err != nil {
414 return nil, err 422 return nil, err
415 } 423 }
416 return a.Client() 424 return a.Client()
417 } 425 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698