| 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 "bytes" | 8 "bytes" |
| 9 "encoding/hex" | 9 "encoding/hex" |
| 10 "fmt" | 10 "fmt" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 } | 526 } |
| 527 | 527 |
| 528 sreq := storage.GetRequest{ | 528 sreq := storage.GetRequest{ |
| 529 Project: sa.project, | 529 Project: sa.project, |
| 530 Path: sa.path, | 530 Path: sa.path, |
| 531 KeysOnly: true, | 531 KeysOnly: true, |
| 532 } | 532 } |
| 533 | 533 |
| 534 nextIndex := types.MessageIndex(0) | 534 nextIndex := types.MessageIndex(0) |
| 535 var ierr error | 535 var ierr error |
| 536 » err := sa.Storage.Get(sreq, func(idx types.MessageIndex, d []byte) bool
{ | 536 » err := sa.Storage.Get(sreq, func(e *storage.Entry) bool { |
| 537 » » idx, err := e.GetStreamIndex() |
| 538 » » if err != nil { |
| 539 » » » ierr = errors.Annotate(err).Reason("could not get stream
index").Err() |
| 540 » » » return false |
| 541 » » } |
| 542 |
| 537 switch { | 543 switch { |
| 538 case idx != nextIndex: | 544 case idx != nextIndex: |
| 539 ierr = fmt.Errorf("missing log entry index %d (next %d)"
, nextIndex, idx) | 545 ierr = fmt.Errorf("missing log entry index %d (next %d)"
, nextIndex, idx) |
| 540 return false | 546 return false |
| 541 | 547 |
| 542 case idx == sa.terminalIndex: | 548 case idx == sa.terminalIndex: |
| 543 // We have hit our terminal index, so all of the log dat
a is here! | 549 // We have hit our terminal index, so all of the log dat
a is here! |
| 544 return false | 550 return false |
| 545 | 551 |
| 546 default: | 552 default: |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 792 return e.inner | 798 return e.inner |
| 793 } | 799 } |
| 794 | 800 |
| 795 func isFailure(err error) bool { | 801 func isFailure(err error) bool { |
| 796 if err == nil { | 802 if err == nil { |
| 797 return false | 803 return false |
| 798 } | 804 } |
| 799 _, ok := err.(*statusErrorWrapper) | 805 _, ok := err.(*statusErrorWrapper) |
| 800 return !ok | 806 return !ok |
| 801 } | 807 } |
| OLD | NEW |