| 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 logs | 5 package logs |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 ds "github.com/luci/gae/service/datastore" | 8 ds "github.com/luci/gae/service/datastore" |
| 9 "github.com/luci/luci-go/appengine/logdog/coordinator" | 9 "github.com/luci/luci-go/appengine/logdog/coordinator" |
| 10 "github.com/luci/luci-go/appengine/logdog/coordinator/hierarchy" | 10 "github.com/luci/luci-go/appengine/logdog/coordinator/hierarchy" |
| 11 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" | 11 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" |
| 12 "github.com/luci/luci-go/common/grpcutil" | 12 "github.com/luci/luci-go/common/grpcutil" |
| 13 log "github.com/luci/luci-go/common/logging" | 13 log "github.com/luci/luci-go/common/logging" |
| 14 "golang.org/x/net/context" | 14 "golang.org/x/net/context" |
| 15 "google.golang.org/grpc/codes" | 15 "google.golang.org/grpc/codes" |
| 16 ) | 16 ) |
| 17 | 17 |
| 18 const ( | 18 const ( |
| 19 // listResultLimit is the maximum number of log streams that will be | 19 // listResultLimit is the maximum number of log streams that will be |
| 20 // returned in a single query. If the user requests more, it will be | 20 // returned in a single query. If the user requests more, it will be |
| 21 // automatically truncated to this value. | 21 // automatically truncated to this value. |
| 22 listResultLimit = 500 | 22 listResultLimit = 500 |
| 23 ) | 23 ) |
| 24 | 24 |
| 25 // List returns log stream paths rooted under the hierarchy. | 25 // List returns log stream paths rooted under the hierarchy. |
| 26 func (s *server) List(c context.Context, req *logdog.ListRequest) (*logdog.ListR
esponse, error) { | 26 func (s *server) List(c context.Context, req *logdog.ListRequest) (*logdog.ListR
esponse, error) { |
| 27 log.Fields{ |
| 28 "project": req.Project, |
| 29 "path": req.Path, |
| 30 "recursive": req.Recursive, |
| 31 "offset": req.Offset, |
| 32 "maxResults": req.MaxResults, |
| 33 "streamOnly": req.StreamOnly, |
| 34 "includePurged": req.IncludePurged, |
| 35 }.Debugf(c, "Received List request.") |
| 36 |
| 27 hr := hierarchy.Request{ | 37 hr := hierarchy.Request{ |
| 28 Base: req.Path, | 38 Base: req.Path, |
| 29 Recursive: req.Recursive, | 39 Recursive: req.Recursive, |
| 30 StreamOnly: req.StreamOnly, | 40 StreamOnly: req.StreamOnly, |
| 31 Limit: s.limit(int(req.MaxResults), listResultLimit), | 41 Limit: s.limit(int(req.MaxResults), listResultLimit), |
| 32 Next: req.Next, | 42 Next: req.Next, |
| 33 Skip: int(req.Offset), | 43 Skip: int(req.Offset), |
| 34 } | 44 } |
| 35 | 45 |
| 36 // Non-admin users may not request purged results. | 46 // Non-admin users may not request purged results. |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 118 } |
| 109 } | 119 } |
| 110 } | 120 } |
| 111 } | 121 } |
| 112 | 122 |
| 113 log.Fields{ | 123 log.Fields{ |
| 114 "count": len(resp.Components), | 124 "count": len(resp.Components), |
| 115 }.Infof(c, "List completed successfully.") | 125 }.Infof(c, "List completed successfully.") |
| 116 return &resp, nil | 126 return &resp, nil |
| 117 } | 127 } |
| OLD | NEW |