| OLD | NEW |
| 1 // Copyright 2016 The LUCI Authors. All rights reserved. | 1 // Copyright 2016 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 archivist | 5 package archivist |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "io" | 8 "io" |
| 9 | 9 |
| 10 "github.com/luci/luci-go/common/config" | |
| 11 log "github.com/luci/luci-go/common/logging" | 10 log "github.com/luci/luci-go/common/logging" |
| 12 "github.com/luci/luci-go/logdog/api/logpb" | 11 "github.com/luci/luci-go/logdog/api/logpb" |
| 13 "github.com/luci/luci-go/logdog/common/storage" | 12 "github.com/luci/luci-go/logdog/common/storage" |
| 14 "github.com/luci/luci-go/logdog/common/types" | 13 "github.com/luci/luci-go/logdog/common/types" |
| 14 "github.com/luci/luci-go/luci_config/common/cfgtypes" |
| 15 "golang.org/x/net/context" | 15 "golang.org/x/net/context" |
| 16 ) | 16 ) |
| 17 | 17 |
| 18 // storageSource is a renderer.Source that pulls log entries from intermediate | 18 // storageSource is a renderer.Source that pulls log entries from intermediate |
| 19 // storage via its storage.Storage instance. | 19 // storage via its storage.Storage instance. |
| 20 type storageSource struct { | 20 type storageSource struct { |
| 21 context.Context | 21 context.Context |
| 22 | 22 |
| 23 » st storage.Storage // the storage instance to read from | 23 » st storage.Storage // the storage instance to read from |
| 24 » project config.ProjectName // the path of the log stream | 24 » project cfgtypes.ProjectName // the path of the log stream |
| 25 » path types.StreamPath // the path of the log stream | 25 » path types.StreamPath // the path of the log stream |
| 26 » terminalIndex types.MessageIndex // if >= 0, discard logs beyond this | 26 » terminalIndex types.MessageIndex // if >= 0, discard logs beyond this |
| 27 | 27 |
| 28 buf []*logpb.LogEntry | 28 buf []*logpb.LogEntry |
| 29 lastIndex types.MessageIndex | 29 lastIndex types.MessageIndex |
| 30 logEntryCount int64 | 30 logEntryCount int64 |
| 31 } | 31 } |
| 32 | 32 |
| 33 func (s *storageSource) bufferEntries(start types.MessageIndex) error { | 33 func (s *storageSource) bufferEntries(start types.MessageIndex) error { |
| 34 bytes := 0 | 34 bytes := 0 |
| 35 | 35 |
| 36 req := storage.GetRequest{ | 36 req := storage.GetRequest{ |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 "index": sidx, | 96 "index": sidx, |
| 97 "terminalIndex": s.terminalIndex, | 97 "terminalIndex": s.terminalIndex, |
| 98 }.Warningf(s, "Discarding log entries beyond expected terminal i
ndex.") | 98 }.Warningf(s, "Discarding log entries beyond expected terminal i
ndex.") |
| 99 return nil, io.EOF | 99 return nil, io.EOF |
| 100 } | 100 } |
| 101 | 101 |
| 102 s.lastIndex = sidx | 102 s.lastIndex = sidx |
| 103 s.logEntryCount++ | 103 s.logEntryCount++ |
| 104 return le, nil | 104 return le, nil |
| 105 } | 105 } |
| OLD | NEW |