Package io.pravega.client.batch.impl
Class BatchClientFactoryImpl
- java.lang.Object
-
- io.pravega.client.batch.impl.BatchClientFactoryImpl
-
- All Implemented Interfaces:
BatchClientFactory
,java.lang.AutoCloseable
@Beta public class BatchClientFactoryImpl extends java.lang.Object implements BatchClientFactory
-
-
Constructor Summary
Constructors Constructor Description BatchClientFactoryImpl(Controller controller, ClientConfig clientConfig, ConnectionFactory connectionFactory)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Closes the client factory.StreamSegmentsIterator
getSegments(Stream stream, StreamCut fromStreamCut, StreamCut toStreamCut)
Provides a list of segments for a given stream between fromStreamCut and toStreamCut.<T> SegmentIterator<T>
readSegment(SegmentRange segment, Serializer<T> deserializer)
Provides a SegmentIterator to read the events in the requested segment starting from the beginning of the segment and ending at the current end of the segment.
-
-
-
Constructor Detail
-
BatchClientFactoryImpl
public BatchClientFactoryImpl(Controller controller, ClientConfig clientConfig, ConnectionFactory connectionFactory)
-
-
Method Detail
-
getSegments
public StreamSegmentsIterator getSegments(Stream stream, StreamCut fromStreamCut, StreamCut toStreamCut)
Description copied from interface:BatchClientFactory
Provides a list of segments for a given stream between fromStreamCut and toStreamCut. Passing StreamCut.UNBOUNDED or null to fromStreamCut and toStreamCut will result in using the current start of stream and the current end of stream respectively. Note: In case of stream truncation:- Passing a null to fromStreamCut will result in using the current start of the Stream post truncation.
- Passing a fromStreamCut which points to the truncated stream will result in a
NoSuchSegmentException
while iterating over SegmentRange iterator obtained viaStreamSegmentsIterator.getIterator()
- Specified by:
getSegments
in interfaceBatchClientFactory
- Parameters:
stream
- the stream.fromStreamCut
- starting stream cut.toStreamCut
- end stream cut.- Returns:
- Segment information between the two stream cuts.
-
readSegment
public <T> SegmentIterator<T> readSegment(SegmentRange segment, Serializer<T> deserializer)
Description copied from interface:BatchClientFactory
Provides a SegmentIterator to read the events in the requested segment starting from the beginning of the segment and ending at the current end of the segment.- Specified by:
readSegment
in interfaceBatchClientFactory
- Type Parameters:
T
- The type of events written to the segment.- Parameters:
segment
- The segment to read fromdeserializer
- A deserializer to be used to parse events- Returns:
- A SegmentIterator over the requested segment
-
close
public void close()
Description copied from interface:BatchClientFactory
Closes the client factory. This will close any connections created through it.- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfaceBatchClientFactory
- See Also:
AutoCloseable.close()
-
-