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