| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 archivist | 5 package archivist |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "fmt" | 8 "fmt" |
| 9 | 9 |
| 10 "github.com/golang/protobuf/proto" | 10 "github.com/golang/protobuf/proto" |
| (...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 hasMissingEntries bool // true if some log entries were missing. | 348 hasMissingEntries bool // true if some log entries were missing. |
| 349 } | 349 } |
| 350 | 350 |
| 351 func (s *storageSource) bufferEntries(start types.MessageIndex) error { | 351 func (s *storageSource) bufferEntries(start types.MessageIndex) error { |
| 352 bytes := 0 | 352 bytes := 0 |
| 353 | 353 |
| 354 req := storage.GetRequest{ | 354 req := storage.GetRequest{ |
| 355 Path: s.path, | 355 Path: s.path, |
| 356 Index: start, | 356 Index: start, |
| 357 } | 357 } |
| 358 » return s.st.Get(&req, func(idx types.MessageIndex, d []byte) bool { | 358 » return s.st.Get(req, func(idx types.MessageIndex, d []byte) bool { |
| 359 le := logpb.LogEntry{} | 359 le := logpb.LogEntry{} |
| 360 if err := proto.Unmarshal(d, &le); err != nil { | 360 if err := proto.Unmarshal(d, &le); err != nil { |
| 361 log.Fields{ | 361 log.Fields{ |
| 362 log.ErrorKey: err, | 362 log.ErrorKey: err, |
| 363 "streamIndex": idx, | 363 "streamIndex": idx, |
| 364 }.Errorf(s, "Failed to unmarshal LogEntry.") | 364 }.Errorf(s, "Failed to unmarshal LogEntry.") |
| 365 return false | 365 return false |
| 366 } | 366 } |
| 367 s.buf = append(s.buf, &le) | 367 s.buf = append(s.buf, &le) |
| 368 | 368 |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 log.Fields{ | 418 log.Fields{ |
| 419 "index": sidx, | 419 "index": sidx, |
| 420 "terminalIndex": s.terminalIndex, | 420 "terminalIndex": s.terminalIndex, |
| 421 }.Warningf(s, "Discarding log entries beyond expected terminal i
ndex.") | 421 }.Warningf(s, "Discarding log entries beyond expected terminal i
ndex.") |
| 422 return nil, archive.ErrEndOfStream | 422 return nil, archive.ErrEndOfStream |
| 423 } | 423 } |
| 424 | 424 |
| 425 s.lastIndex = sidx | 425 s.lastIndex = sidx |
| 426 return le, nil | 426 return le, nil |
| 427 } | 427 } |
| OLD | NEW |