| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 config | 5 package config |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 gaeauthClient "github.com/luci/luci-go/appengine/gaeauth/client" | 8 gaeauthClient "github.com/luci/luci-go/appengine/gaeauth/client" |
| 9 "github.com/luci/luci-go/common/errors" | 9 "github.com/luci/luci-go/common/errors" |
| 10 log "github.com/luci/luci-go/common/logging" | 10 log "github.com/luci/luci-go/common/logging" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 72 if err != nil { | 72 if err != nil { |
| 73 log.WithError(err).Errorf(c, "Failed to create BigTable authenti
cator.") | 73 log.WithError(err).Errorf(c, "Failed to create BigTable authenti
cator.") |
| 74 return nil, errors.New("failed to create BigTable authenticator"
) | 74 return nil, errors.New("failed to create BigTable authenticator"
) |
| 75 } | 75 } |
| 76 | 76 |
| 77 // Explicitly clear gRPC metadata from the Context. It is forwarded to | 77 // Explicitly clear gRPC metadata from the Context. It is forwarded to |
| 78 // delegate calls by default, and standard request metadata can break Bi
gTable | 78 // delegate calls by default, and standard request metadata can break Bi
gTable |
| 79 // calls. | 79 // calls. |
| 80 c = metadata.NewContext(c, nil) | 80 c = metadata.NewContext(c, nil) |
| 81 | 81 |
| 82 » return bigtable.New(c, bigtable.Options{ | 82 » st, err := bigtable.New(c, bigtable.Options{ |
| 83 Project: bt.Project, | 83 Project: bt.Project, |
| 84 Zone: bt.Zone, | 84 Zone: bt.Zone, |
| 85 Cluster: bt.Cluster, | 85 Cluster: bt.Cluster, |
| 86 LogTable: bt.LogTableName, | 86 LogTable: bt.LogTableName, |
| 87 ClientOptions: []cloud.ClientOption{ | 87 ClientOptions: []cloud.ClientOption{ |
| 88 cloud.WithTokenSource(a.TokenSource()), | 88 cloud.WithTokenSource(a.TokenSource()), |
| 89 }, | 89 }, |
| 90 » }), nil | 90 » }) |
| 91 » if err != nil { |
| 92 » » log.WithError(err).Errorf(c, "Failed to create BigTable instance
.") |
| 93 » » return nil, err |
| 94 » } |
| 95 » return st, nil |
| 91 } | 96 } |
| OLD | NEW |