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 coordinator | 5 package coordinator |
6 | 6 |
7 import ( | 7 import ( |
8 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" | 8 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" |
9 "github.com/luci/luci-go/common/auth" | 9 "github.com/luci/luci-go/common/auth" |
| 10 "github.com/luci/luci-go/common/config" |
10 "github.com/luci/luci-go/common/logdog/types" | 11 "github.com/luci/luci-go/common/logdog/types" |
11 "github.com/luci/luci-go/common/prpc" | 12 "github.com/luci/luci-go/common/prpc" |
12 ) | 13 ) |
13 | 14 |
14 var ( | 15 var ( |
15 // Scopes is the set of scopes needed for the Coordinator user endpoints
. | 16 // Scopes is the set of scopes needed for the Coordinator user endpoints
. |
16 Scopes = []string{ | 17 Scopes = []string{ |
17 auth.OAuthScopeEmail, | 18 auth.OAuthScopeEmail, |
18 } | 19 } |
19 ) | 20 ) |
20 | 21 |
21 // Client wraps a Logs client with user-friendly methods. | 22 // Client wraps a Logs client with user-friendly methods. |
22 // | 23 // |
23 // Each method should operate independently, so calling methods from different | 24 // Each method should operate independently, so calling methods from different |
24 // goroutines must not cause any problems. | 25 // goroutines must not cause any problems. |
25 type Client struct { | 26 type Client struct { |
26 // C is the underlying LogsClient interface. | 27 // C is the underlying LogsClient interface. |
27 C logdog.LogsClient | 28 C logdog.LogsClient |
| 29 |
| 30 project config.ProjectName |
28 } | 31 } |
29 | 32 |
30 // NewClient returns a new Client instance bound to a pRPC Client. | 33 // NewClient returns a new Client instance bound to a pRPC Client. |
31 func NewClient(c *prpc.Client) *Client { | 34 func NewClient(c *prpc.Client, project config.ProjectName) *Client { |
32 return &Client{ | 35 return &Client{ |
33 » » C: logdog.NewLogsPRPCClient(c), | 36 » » C: logdog.NewLogsPRPCClient(c), |
| 37 » » project: project, |
34 } | 38 } |
35 } | 39 } |
36 | 40 |
37 // Stream returns a Stream instance for the named stream. | 41 // Stream returns a Stream instance for the named stream. |
38 func (c *Client) Stream(path types.StreamPath) *Stream { | 42 func (c *Client) Stream(path types.StreamPath) *Stream { |
39 return &Stream{ | 43 return &Stream{ |
40 c: c, | 44 c: c, |
41 path: path, | 45 path: path, |
42 } | 46 } |
43 } | 47 } |
OLD | NEW |