733
734
// persistence helper
735
>
func (s *HistoryV2PersistenceSuite) read(branch []byte, minID, maxID int64) []*historypb.HistoryEvent {
history_v2_persistence.go
736
>
res, err := s.readWithError(branch, minID, maxID)
737
>
s.Nil(err)
738
>
return res
739
>
}
740
741
>
func (s *HistoryV2PersistenceSuite) readWithError(branch []byte, minID, maxID int64) ([]*historypb.HistoryEvent, error) {
history_v2_persistence.go
742
>
743
>
// use small page size to enforce pagination
744
>
randPageSize := 2
745
>
res := make([]*historypb.HistoryEvent, 0)
746
>
token := []byte{}
747
>
for {
748
>
resp, err := s.ExecutionManager.ReadHistoryBranch(s.ctx, &p.ReadHistoryBranchRequest{
749
>
BranchToken: branch,
750
>
MinEventID: minID,
751
>
MaxEventID: maxID,
752
>
PageSize: randPageSize,
753
>
NextPageToken: token,
754
>
ShardID: s.ShardInfo.GetShardId(),
755
>
})
756
>
if err != nil {
757
return nil, err
758
}
760
>
s.True(resp.Size > 0)
761
>
}
762
>
res = append(res, resp.HistoryEvents...)
763
>
token = resp.NextPageToken
764
>
if len(token) == 0 {
765
>
break
766
}
767
}
768
770
}
771