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