| 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 "github.com/luci/luci-go/appengine/logdog/coordinator" | 8 "github.com/luci/luci-go/appengine/logdog/coordinator" |
| 9 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" | 9 "github.com/luci/luci-go/common/api/logdog_coordinator/logs/v1" |
| 10 ) | 10 ) |
| 11 | 11 |
| 12 // Server is the user-facing log access and query endpoint service. | 12 // Server is the user-facing log access and query endpoint service. |
| 13 type Server struct { | 13 type Server struct { |
| 14 » coordinator.Service | 14 » coordinator.ServiceBase |
| 15 | 15 |
| 16 // resultLimit is the maximum number of query results to return in a | 16 // resultLimit is the maximum number of query results to return in a |
| 17 // single query. If zero, the default will be used. | 17 // single query. If zero, the default will be used. |
| 18 // | 18 // |
| 19 // This is provided for testing purposes. | 19 // This is provided for testing purposes. |
| 20 resultLimit int | 20 resultLimit int |
| 21 } | 21 } |
| 22 | 22 |
| 23 var _ logdog.LogsServer = (*Server)(nil) |
| 24 |
| 23 func (s *Server) limit(v int, d int) int { | 25 func (s *Server) limit(v int, d int) int { |
| 24 if s.resultLimit > 0 { | 26 if s.resultLimit > 0 { |
| 25 d = s.resultLimit | 27 d = s.resultLimit |
| 26 } | 28 } |
| 27 if v <= 0 || v > d { | 29 if v <= 0 || v > d { |
| 28 return d | 30 return d |
| 29 } | 31 } |
| 30 return v | 32 return v |
| 31 } | 33 } |
| 32 | |
| 33 var _ logdog.LogsServer = (*Server)(nil) | |
| OLD | NEW |