use of io.pravega.client.stream.impl.StreamSegmentSuccessors in project pravega by pravega.
the class BatchClientImpl method getStreamSegmentInfo.
private StreamSegmentsIterator getStreamSegmentInfo(final StreamCut startStreamCut, final StreamCut endStreamCut) {
log.debug("Start stream cut: {}, End stream cut: {}", startStreamCut, endStreamCut);
StreamSegmentsInfoImpl.validateStreamCuts(startStreamCut, endStreamCut);
final SortedSet<Segment> segmentSet = new TreeSet<>();
StreamSegmentSuccessors segments = getAndHandleExceptions(controller.getSegments(startStreamCut, endStreamCut), RuntimeException::new);
segmentSet.addAll(segments.getSegments());
synchronized (this) {
latestDelegationToken.set(segments.getDelegationToken());
}
log.debug("List of Segments between the start and end stream cuts : {}", segmentSet);
Iterator<SegmentRange> iterator = Iterators.transform(segmentSet.iterator(), s -> getSegmentRange(s, startStreamCut, endStreamCut));
return StreamSegmentsInfoImpl.builder().segmentRangeIterator(iterator).startStreamCut(startStreamCut).endStreamCut(endStreamCut).build();
}
Aggregations