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

Unified Diff: server/logdog/storage/archive/storage.go

Issue 1672833003: LogDog: Add log rendering view. Base URL: https://github.com/luci/luci-go@master
Patch Set: Clean up, add tests, little reorg. Created 4 years, 10 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
« no previous file with comments | « common/logdog/fetcher/fetcher_test.go ('k') | server/logdog/storage/bigtable/bigtable.go » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: server/logdog/storage/archive/storage.go
diff --git a/server/logdog/storage/archive/storage.go b/server/logdog/storage/archive/storage.go
index 159cb27d11b7aed236189995b982172c3f8b003e..5b0d6caa3bb5f61b441cda350adbc38b83d77dd1 100644
--- a/server/logdog/storage/archive/storage.go
+++ b/server/logdog/storage/archive/storage.go
@@ -53,7 +53,7 @@ type Options struct {
// Client is the HTTP client to use for authentication.
//
- // Closing this Storage instance does not close the underlying Client.
+ // Closing this Storage instance will close the underlying Client.
Client gs.Client
}
@@ -66,9 +66,8 @@ type storageImpl struct {
indexBucket string
indexPath string
- indexMu sync.Mutex
- index *logpb.LogIndex
- closeClient bool
+ indexMu sync.Mutex
+ index *logpb.LogIndex
}
// New instantiates a new Storage instance, bound to the supplied Options.
@@ -94,18 +93,14 @@ func New(c context.Context, o Options) (storage.Storage, error) {
if err != nil {
return nil, err
}
-
- s.closeClient = true
}
return &s, nil
}
func (s *storageImpl) Close() {
- if s.closeClient {
- if err := s.Client.Close(); err != nil {
- log.WithError(err).Errorf(s, "Failed to close client.")
- }
+ if err := s.Client.Close(); err != nil {
+ log.WithError(err).Errorf(s, "Failed to close client.")
}
}
@@ -320,7 +315,7 @@ func (s *storageImpl) buildGetStrategy(req *storage.GetRequest, idx *logpb.LogIn
// for sure that we have one LogEntry per index entry, so that's the best we
// can do.
if req.Limit > 0 {
- if ub := startIdx + req.Limit; ub < len(idx.Entries) {
+ if ub := int64(startIdx) + req.Limit; ub < int64(len(idx.Entries)) {
st.to = int64(idx.Entries[ub].Offset)
}
}
« no previous file with comments | « common/logdog/fetcher/fetcher_test.go ('k') | server/logdog/storage/bigtable/bigtable.go » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698