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

Side by Side Diff: logdog/client/butler/output/logdog/output.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/client/butler/butler.go ('k') | logdog/client/butlerlib/bootstrap/bootstrap.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 logdog 5 package logdog
6 6
7 import ( 7 import (
8 "fmt" 8 "fmt"
9 "runtime" 9 "runtime"
10 "time" 10 "time"
11 11
12 "github.com/luci/luci-go/common/auth" 12 "github.com/luci/luci-go/common/auth"
13 "github.com/luci/luci-go/common/config"
14 "github.com/luci/luci-go/common/errors" 13 "github.com/luci/luci-go/common/errors"
15 ps "github.com/luci/luci-go/common/gcloud/pubsub" 14 ps "github.com/luci/luci-go/common/gcloud/pubsub"
16 "github.com/luci/luci-go/common/lhttp" 15 "github.com/luci/luci-go/common/lhttp"
17 log "github.com/luci/luci-go/common/logging" 16 log "github.com/luci/luci-go/common/logging"
18 "github.com/luci/luci-go/common/proto/google" 17 "github.com/luci/luci-go/common/proto/google"
19 "github.com/luci/luci-go/common/retry" 18 "github.com/luci/luci-go/common/retry"
20 "github.com/luci/luci-go/grpc/prpc" 19 "github.com/luci/luci-go/grpc/prpc"
21 api "github.com/luci/luci-go/logdog/api/endpoints/coordinator/registrati on/v1" 20 api "github.com/luci/luci-go/logdog/api/endpoints/coordinator/registrati on/v1"
22 "github.com/luci/luci-go/logdog/client/butler/output" 21 "github.com/luci/luci-go/logdog/client/butler/output"
23 out "github.com/luci/luci-go/logdog/client/butler/output/pubsub" 22 out "github.com/luci/luci-go/logdog/client/butler/output/pubsub"
24 "github.com/luci/luci-go/logdog/common/types" 23 "github.com/luci/luci-go/logdog/common/types"
24 "github.com/luci/luci-go/luci_config/common/cfgtypes"
25 25
26 "cloud.google.com/go/pubsub" 26 "cloud.google.com/go/pubsub"
27 "golang.org/x/net/context" 27 "golang.org/x/net/context"
28 "google.golang.org/api/option" 28 "google.golang.org/api/option"
29 ) 29 )
30 30
31 // Scopes returns the set of OAuth scopes required for this Output. 31 // Scopes returns the set of OAuth scopes required for this Output.
32 func Scopes() []string { 32 func Scopes() []string {
33 // E-mail scope needed for Coordinator authentication. 33 // E-mail scope needed for Coordinator authentication.
34 scopes := []string{auth.OAuthScopeEmail} 34 scopes := []string{auth.OAuthScopeEmail}
35 // Publisher scope needed to publish to Pub/Sub transport. 35 // Publisher scope needed to publish to Pub/Sub transport.
36 scopes = append(scopes, ps.PublisherScopes...) 36 scopes = append(scopes, ps.PublisherScopes...)
37 37
38 return scopes 38 return scopes
39 } 39 }
40 40
41 // Config is the set of configuration parameters for this Output instance. 41 // Config is the set of configuration parameters for this Output instance.
42 type Config struct { 42 type Config struct {
43 // Auth is the Authenticator to use for registration and publishing. It should 43 // Auth is the Authenticator to use for registration and publishing. It should
44 // be configured to hold the scopes returned by Scopes. 44 // be configured to hold the scopes returned by Scopes.
45 Auth *auth.Authenticator 45 Auth *auth.Authenticator
46 46
47 // Host is the name of the LogDog Host to connect to. 47 // Host is the name of the LogDog Host to connect to.
48 Host string 48 Host string
49 49
50 // Project is the project that this stream belongs to. 50 // Project is the project that this stream belongs to.
51 » Project config.ProjectName 51 » Project cfgtypes.ProjectName
52 // Prefix is the stream prefix to register. 52 // Prefix is the stream prefix to register.
53 Prefix types.StreamName 53 Prefix types.StreamName
54 // PrefixExpiration is the prefix expiration to use when registering. 54 // PrefixExpiration is the prefix expiration to use when registering.
55 // If zero, no expiration will be expressed to the Coordinator, and it w ill 55 // If zero, no expiration will be expressed to the Coordinator, and it w ill
56 // choose based on its configuration. 56 // choose based on its configuration.
57 PrefixExpiration time.Duration 57 PrefixExpiration time.Duration
58 58
59 // SourceInfo, if not empty, is auxiliary source information to register 59 // SourceInfo, if not empty, is auxiliary source information to register
60 // alongside the stream. 60 // alongside the stream.
61 SourceInfo []string 61 SourceInfo []string
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 exists, err = t.Exists(ctx) 217 exists, err = t.Exists(ctx)
218 return 218 return
219 }, func(err error, d time.Duration) { 219 }, func(err error, d time.Duration) {
220 log.Fields{ 220 log.Fields{
221 log.ErrorKey: err, 221 log.ErrorKey: err,
222 "delay": d, 222 "delay": d,
223 }.Errorf(ctx, "Failed to check if topic exists; retrying...") 223 }.Errorf(ctx, "Failed to check if topic exists; retrying...")
224 }) 224 })
225 return exists, err 225 return exists, err
226 } 226 }
OLDNEW
« no previous file with comments | « logdog/client/butler/butler.go ('k') | logdog/client/butlerlib/bootstrap/bootstrap.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698