| OLD | NEW |
| 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 coordinator | 5 package coordinator |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | |
| 9 | |
| 10 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" | 8 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" |
| 11 "github.com/luci/luci-go/logdog/common/types" | 9 "github.com/luci/luci-go/logdog/common/types" |
| 12 "github.com/luci/luci-go/luci_config/common/cfgtypes" | 10 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 13 "golang.org/x/net/context" | 11 "golang.org/x/net/context" |
| 14 ) | 12 ) |
| 15 | 13 |
| 16 // ListResult is a single returned list entry. | 14 // ListResult is a single returned list entry. |
| 17 type ListResult struct { | 15 type ListResult struct { |
| 18 // Project is the project that this result is bound to. | 16 // Project is the project that this result is bound to. |
| 19 Project cfgtypes.ProjectName | 17 Project cfgtypes.ProjectName |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 PathBase: types.StreamPath(resp.PathBase), | 79 PathBase: types.StreamPath(resp.PathBase), |
| 82 Name: s.Name, | 80 Name: s.Name, |
| 83 } | 81 } |
| 84 switch s.Type { | 82 switch s.Type { |
| 85 case logdog.ListResponse_Component_PATH: | 83 case logdog.ListResponse_Component_PATH: |
| 86 break | 84 break |
| 87 | 85 |
| 88 case logdog.ListResponse_Component_STREAM: | 86 case logdog.ListResponse_Component_STREAM: |
| 89 lr.Stream = true | 87 lr.Stream = true |
| 90 if s.State != nil { | 88 if s.State != nil { |
| 91 » » » » » lr.State, err = loadLogStream(resp.Proje
ct, lr.FullPath(), s.State, s.Desc) | 89 » » » » » lr.State = loadLogStream(resp.Project, l
r.FullPath(), s.State, s.Desc) |
| 92 » » » » » if err != nil { | |
| 93 » » » » » » return fmt.Errorf("failed to loa
d stream state: %v", err) | |
| 94 » » » » » } | |
| 95 } | 90 } |
| 96 | 91 |
| 97 case logdog.ListResponse_Component_PROJECT: | 92 case logdog.ListResponse_Component_PROJECT: |
| 98 lr.Project = cfgtypes.ProjectName(lr.Name) | 93 lr.Project = cfgtypes.ProjectName(lr.Name) |
| 99 } | 94 } |
| 100 | 95 |
| 101 if !cb(&lr) { | 96 if !cb(&lr) { |
| 102 return nil | 97 return nil |
| 103 } | 98 } |
| 104 } | 99 } |
| 105 | 100 |
| 106 if resp.Next == "" { | 101 if resp.Next == "" { |
| 107 return nil | 102 return nil |
| 108 } | 103 } |
| 109 req.Next = resp.Next | 104 req.Next = resp.Next |
| 110 } | 105 } |
| 111 } | 106 } |
| OLD | NEW |