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