| 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 cli | 5 package cli |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "errors" | 8 "errors" |
| 9 "io" | 9 "io" |
| 10 "os" | 10 "os" |
| 11 | 11 |
| 12 "github.com/golang/protobuf/proto" | 12 "github.com/golang/protobuf/proto" |
| 13 "github.com/luci/luci-go/common/config" | |
| 14 log "github.com/luci/luci-go/common/logging" | 13 log "github.com/luci/luci-go/common/logging" |
| 15 "github.com/luci/luci-go/common/proto/milo" | 14 "github.com/luci/luci-go/common/proto/milo" |
| 16 "github.com/luci/luci-go/logdog/api/logpb" | 15 "github.com/luci/luci-go/logdog/api/logpb" |
| 17 "github.com/luci/luci-go/logdog/client/coordinator" | 16 "github.com/luci/luci-go/logdog/client/coordinator" |
| 18 "github.com/luci/luci-go/logdog/common/fetcher" | 17 "github.com/luci/luci-go/logdog/common/fetcher" |
| 19 "github.com/luci/luci-go/logdog/common/renderer" | 18 "github.com/luci/luci-go/logdog/common/renderer" |
| 20 "github.com/luci/luci-go/logdog/common/types" | 19 "github.com/luci/luci-go/logdog/common/types" |
| 20 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 21 | 21 |
| 22 "github.com/maruel/subcommands" | 22 "github.com/maruel/subcommands" |
| 23 "golang.org/x/net/context" | 23 "golang.org/x/net/context" |
| 24 ) | 24 ) |
| 25 | 25 |
| 26 var errDatagramNotSupported = errors.New("datagram not supported") | 26 var errDatagramNotSupported = errors.New("datagram not supported") |
| 27 | 27 |
| 28 type catCommandRun struct { | 28 type catCommandRun struct { |
| 29 subcommands.CommandRunBase | 29 subcommands.CommandRunBase |
| 30 | 30 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 } | 109 } |
| 110 return 1 | 110 return 1 |
| 111 } | 111 } |
| 112 } | 112 } |
| 113 | 113 |
| 114 return 0 | 114 return 0 |
| 115 } | 115 } |
| 116 | 116 |
| 117 // streamPath is a single path to fetch. | 117 // streamPath is a single path to fetch. |
| 118 type streamPath struct { | 118 type streamPath struct { |
| 119 » project config.ProjectName | 119 » project cfgtypes.ProjectName |
| 120 path types.StreamPath | 120 path types.StreamPath |
| 121 } | 121 } |
| 122 | 122 |
| 123 func (cmd *catCommandRun) catPath(c context.Context, coord *coordinator.Client,
sp *streamPath) error { | 123 func (cmd *catCommandRun) catPath(c context.Context, coord *coordinator.Client,
sp *streamPath) error { |
| 124 // Pull stream information. | 124 // Pull stream information. |
| 125 src := coordinatorSource{ | 125 src := coordinatorSource{ |
| 126 stream: coord.Stream(sp.project, sp.path), | 126 stream: coord.Stream(sp.project, sp.path), |
| 127 } | 127 } |
| 128 src.tidx = -1 // Must be set to probe for state. | 128 src.tidx = -1 // Must be set to probe for state. |
| 129 | 129 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 173 } | 173 } |
| 174 | 174 |
| 175 if err := proto.MarshalText(w, pb); err != nil { | 175 if err := proto.MarshalText(w, pb); err != nil { |
| 176 log.WithError(err).Errorf(c, "Failed to marshal datagram
as text.") | 176 log.WithError(err).Errorf(c, "Failed to marshal datagram
as text.") |
| 177 return false | 177 return false |
| 178 } | 178 } |
| 179 | 179 |
| 180 return true | 180 return true |
| 181 } | 181 } |
| 182 } | 182 } |
| OLD | NEW |