Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(276)

Side by Side Diff: logdog/appengine/coordinator/endpoints/logs/get.go

Issue 2626433004: Move "common/config" common types into cfgtypes. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 logs 5 package logs
6 6
7 import ( 7 import (
8 "time" 8 "time"
9 9
10 "github.com/luci/luci-go/common/config"
11 "github.com/luci/luci-go/common/errors" 10 "github.com/luci/luci-go/common/errors"
12 log "github.com/luci/luci-go/common/logging" 11 log "github.com/luci/luci-go/common/logging"
13 "github.com/luci/luci-go/common/proto/google" 12 "github.com/luci/luci-go/common/proto/google"
14 "github.com/luci/luci-go/common/retry" 13 "github.com/luci/luci-go/common/retry"
15 "github.com/luci/luci-go/grpc/grpcutil" 14 "github.com/luci/luci-go/grpc/grpcutil"
16 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1" 15 "github.com/luci/luci-go/logdog/api/endpoints/coordinator/logs/v1"
17 "github.com/luci/luci-go/logdog/api/logpb" 16 "github.com/luci/luci-go/logdog/api/logpb"
18 "github.com/luci/luci-go/logdog/appengine/coordinator" 17 "github.com/luci/luci-go/logdog/appengine/coordinator"
19 "github.com/luci/luci-go/logdog/common/storage" 18 "github.com/luci/luci-go/logdog/common/storage"
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 ds "github.com/luci/gae/service/datastore" 22 ds "github.com/luci/gae/service/datastore"
23 23
24 "golang.org/x/net/context" 24 "golang.org/x/net/context"
25 "google.golang.org/grpc/codes" 25 "google.golang.org/grpc/codes"
26 ) 26 )
27 27
28 const ( 28 const (
29 // getInitialArraySize is the initial amount of log slots to allocate fo r a 29 // getInitialArraySize is the initial amount of log slots to allocate fo r a
30 // Get request. 30 // Get request.
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 Expiration: google.NewTimestamp(signedURLs.Expir ation), 175 Expiration: google.NewTimestamp(signedURLs.Expir ation),
176 Stream: signedURLs.Stream, 176 Stream: signedURLs.Stream,
177 Index: signedURLs.Index, 177 Index: signedURLs.Index,
178 } 178 }
179 } 179 }
180 } 180 }
181 181
182 return nil 182 return nil
183 } 183 }
184 184
185 func getHead(c context.Context, req *logdog.GetRequest, st coordinator.Storage, project config.ProjectName, 185 func getHead(c context.Context, req *logdog.GetRequest, st coordinator.Storage, project cfgtypes.ProjectName,
186 path types.StreamPath, byteLimit int) ([]*logpb.LogEntry, error) { 186 path types.StreamPath, byteLimit int) ([]*logpb.LogEntry, error) {
187 log.Fields{ 187 log.Fields{
188 "project": project, 188 "project": project,
189 "path": path, 189 "path": path,
190 "index": req.Index, 190 "index": req.Index,
191 "count": req.LogCount, 191 "count": req.LogCount,
192 "bytes": req.ByteCount, 192 "bytes": req.ByteCount,
193 "noncontiguous": req.NonContiguous, 193 "noncontiguous": req.NonContiguous,
194 }.Debugf(c, "Issuing Get request.") 194 }.Debugf(c, "Issuing Get request.")
195 195
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
259 log.Fields{ 259 log.Fields{
260 log.ErrorKey: err, 260 log.ErrorKey: err,
261 "initialIndex": req.Index, 261 "initialIndex": req.Index,
262 "nextIndex": sreq.Index, 262 "nextIndex": sreq.Index,
263 "count": len(logs), 263 "count": len(logs),
264 }.Errorf(c, "Failed to execute range request.") 264 }.Errorf(c, "Failed to execute range request.")
265 return nil, err 265 return nil, err
266 } 266 }
267 } 267 }
268 268
269 func getTail(c context.Context, st coordinator.Storage, project config.ProjectNa me, path types.StreamPath) ( 269 func getTail(c context.Context, st coordinator.Storage, project cfgtypes.Project Name, path types.StreamPath) (
270 []*logpb.LogEntry, error) { 270 []*logpb.LogEntry, error) {
271 log.Fields{ 271 log.Fields{
272 "project": project, 272 "project": project,
273 "path": path, 273 "path": path,
274 }.Debugf(c, "Issuing Tail request.") 274 }.Debugf(c, "Issuing Tail request.")
275 275
276 var e *storage.Entry 276 var e *storage.Entry
277 err := retry.Retry(c, retry.TransientOnly(retry.Default), func() (err er ror) { 277 err := retry.Retry(c, retry.TransientOnly(retry.Default), func() (err er ror) {
278 e, err = st.Tail(project, path) 278 e, err = st.Tail(project, path)
279 return 279 return
(...skipping 13 matching lines...) Expand all
293 return []*logpb.LogEntry{le}, nil 293 return []*logpb.LogEntry{le}, nil
294 294
295 case storage.ErrDoesNotExist: 295 case storage.ErrDoesNotExist:
296 return nil, nil 296 return nil, nil
297 297
298 default: 298 default:
299 log.WithError(err).Errorf(c, "Failed to fetch tail log.") 299 log.WithError(err).Errorf(c, "Failed to fetch tail log.")
300 return nil, err 300 return nil, err
301 } 301 }
302 } 302 }
OLDNEW
« no previous file with comments | « logdog/appengine/coordinator/coordinatorTest/service.go ('k') | logdog/appengine/coordinator/endpoints/logs/get_test.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698