code: func (sa *stagedArchival) checkComplete(c context.Context) error {
  	if sa.terminalIndex < 0 {
  		log.Warningf(c, "Cannot archive complete stream with no terminal index.")
  		return statusErr(errors.New("completeness required, but stream has no terminal index"))
  	}
  
  	sreq := storage.GetRequest{
  		Project:  sa.project,
  		Path:     sa.path,
  		KeysOnly: true,
  	}
  
  	nextIndex := types.MessageIndex(0)
  	var ierr error
  	err := sa.Storage.Get(c, sreq, func(e *storage.Entry) bool {
  		idx, err := e.GetStreamIndex()
  		if err != nil {
  			ierr = errors.Annotate(err, "could not get stream index").Err()
  			return false
  		}
  
  		switch {
  		case idx != nextIndex:
  			ierr = fmt.Errorf("missing log entry index %d (next %d)", nextIndex, idx)
  			return false
  
  		case idx == sa.terminalIndex:
  			// We have hit our terminal index, so all of the log data is here!
  			return false
  
  		default:
  			nextIndex++
  			return true
  		}
  	})
  	if ierr != nil {
  		return ierr
  	}
  	if err != nil {
  		return err
  	}
  	return nil
  }
docs: // checkComplete performs a quick scan of intermediate storage to ensure that
  // all of the log stream's records are available.