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

Unified Diff: logdog/appengine/coordinator/endpoints/logs/get.go

Issue 2435113002: LogDog: Add Storage-layer data caching. (Closed)
Patch Set: Fix byteLimit bug. Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: logdog/appengine/coordinator/endpoints/logs/get.go
diff --git a/logdog/appengine/coordinator/endpoints/logs/get.go b/logdog/appengine/coordinator/endpoints/logs/get.go
index 28b37b2a169a582a7c7b14cff1cbcc16660d53ef..5dbc6529b3ec39a313b7399ec1b2543082f135cf 100644
--- a/logdog/appengine/coordinator/endpoints/logs/get.go
+++ b/logdog/appengine/coordinator/endpoints/logs/get.go
@@ -168,6 +168,7 @@ func (s *server) getLogs(c context.Context, req *logdog.GetRequest, tail bool, l
IndexURL: lst.ArchiveIndexURL,
StreamURL: lst.ArchiveStreamURL,
Client: gs,
+ Cache: svc.StorageCache(),
})
if err != nil {
log.WithError(err).Errorf(c, "Failed to create Google Storage storage instance.")
@@ -219,8 +220,8 @@ func getHead(c context.Context, req *logdog.GetRequest, st storage.Storage, proj
Limit: logCount,
}
- count := 0
var ierr error
+ count := 0
err := retry.Retry(c, retry.TransientOnly(retry.Default), func() error {
// Issue the Get request. This may return a transient error, in which case
// we will retry.
@@ -234,14 +235,15 @@ func getHead(c context.Context, req *logdog.GetRequest, st storage.Storage, proj
// Not the first log, and we've exceeded our byte limit.
return false
}
- byteLimit -= len(e.D)
sidx, _ := e.GetStreamIndex() // GetLogEntry succeeded, so this must.
if !(req.NonContiguous || sidx == sreq.Index) {
return false
}
+
logs = append(logs, le)
sreq.Index = sidx + 1
+ byteLimit -= len(e.D)
count++
return !(logCount > 0 && count >= logCount)
})
« no previous file with comments | « logdog/appengine/coordinator/coordinatorTest/storage_cache.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