use of io.pravega.client.segment.impl.SegmentMetadataClientFactory in project pravega by pravega.
the class ReaderGroupImpl method unreadBytes.
@Override
public long unreadBytes() {
@Cleanup StateSynchronizer<ReaderGroupState> synchronizer = createSynchronizer();
synchronizer.fetchUpdates();
Optional<Map<Stream, Map<Segment, Long>>> checkPointedPositions = synchronizer.getState().getPositionsForLastCompletedCheckpoint();
SegmentMetadataClientFactory metaFactory = new SegmentMetadataClientFactoryImpl(controller, connectionFactory);
if (checkPointedPositions.isPresent()) {
log.debug("Computing unread bytes based on the last checkPoint position");
return getUnreadBytes(checkPointedPositions.get(), metaFactory);
} else {
log.info("No checkpoints found, using the last known offset to compute unread bytes");
return getUnreadBytes(synchronizer.getState().getPositions(), metaFactory);
}
}
Aggregations