Search in sources :

Example 1 with StreamSegmentSuccessors

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();
}
Also used : SegmentRange(io.pravega.client.batch.SegmentRange) StreamSegmentSuccessors(io.pravega.client.stream.impl.StreamSegmentSuccessors) TreeSet(java.util.TreeSet) Segment(io.pravega.client.segment.impl.Segment)

Aggregations

SegmentRange (io.pravega.client.batch.SegmentRange)1 Segment (io.pravega.client.segment.impl.Segment)1 StreamSegmentSuccessors (io.pravega.client.stream.impl.StreamSegmentSuccessors)1 TreeSet (java.util.TreeSet)1