Package io.pravega.client.segment.impl
Interface SegmentInputStreamFactory
-
- All Known Implementing Classes:
SegmentInputStreamFactoryImpl
public interface SegmentInputStreamFactory
CreatesSegmentInputStream
for reading from existing segments.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description EventSegmentReader
createEventReaderForSegment(Segment segment)
Opens an existing segment for reading events.EventSegmentReader
createEventReaderForSegment(Segment segment, int bufferSize)
Opens an existing segment for reading.EventSegmentReader
createEventReaderForSegment(Segment segment, int bufferSize, java.util.concurrent.Semaphore hasData, long endOffset)
Open an existing segment for reading up to the provided end offset.EventSegmentReader
createEventReaderForSegment(Segment segment, long startOffset, int bufferSize)
Opens an existing segment for reading.EventSegmentReader
createEventReaderForSegment(Segment segment, long startOffset, long endOffset)
Opens an existing segment for reading events.SegmentInputStream
createInputStreamForSegment(Segment segment, DelegationTokenProvider tokenProvider)
Opens an existing segment for reading bytes.SegmentInputStream
createInputStreamForSegment(Segment segment, DelegationTokenProvider tokenProvider, long startOffset)
Opens an existing segment for reading bytes.
-
-
-
Method Detail
-
createInputStreamForSegment
SegmentInputStream createInputStreamForSegment(Segment segment, DelegationTokenProvider tokenProvider)
Opens an existing segment for reading bytes. This operation will fail if the segment does not exist. This operation may be called multiple times on the same stream from the same client (i.e., there can be concurrent Stream Readers in the same process space).- Parameters:
segment
- The segment to create an input for.tokenProvider
- TheDelegationTokenProvider
instance to be used for obtaining a delegation token.- Returns:
- New instance of SegmentInputStream for reading.
-
createInputStreamForSegment
SegmentInputStream createInputStreamForSegment(Segment segment, DelegationTokenProvider tokenProvider, long startOffset)
Opens an existing segment for reading bytes. This operation will fail if the segment does not exist. This operation may be called multiple times on the same stream from the same client (i.e., there can be concurrent Stream Readers in the same process space).- Parameters:
segment
- The segment to create an input for.tokenProvider
- TheDelegationTokenProvider
instance to be used for obtaining a delegation token.startOffset
- The start offset of the segment.- Returns:
- New instance of SegmentInputStream for reading.
-
createEventReaderForSegment
EventSegmentReader createEventReaderForSegment(Segment segment)
Opens an existing segment for reading events. This operation will fail if the segment does not exist. This operation may be called multiple times on the same segment from the same client (i.e., there can be concurrent Event Readers in the same process space).- Parameters:
segment
- The segment to create an input for.- Returns:
- New instance of EventSegmentReader for reading.
-
createEventReaderForSegment
EventSegmentReader createEventReaderForSegment(Segment segment, long startOffset, long endOffset)
Opens an existing segment for reading events. This operation will fail if the segment does not exist. This operation may be called multiple times on the same segment from the same client (i.e., there can be concurrent Event Readers in the same process space).- Parameters:
segment
- The segment to create an input for.startOffset
- the start offset of the segment.endOffset
- The end offset of the segment.- Returns:
- New instance of EventSegmentReader for reading.
-
createEventReaderForSegment
EventSegmentReader createEventReaderForSegment(Segment segment, int bufferSize, java.util.concurrent.Semaphore hasData, long endOffset)
Open an existing segment for reading up to the provided end offset. This operation will fail if the segment does not exist.- Parameters:
segment
- The segment to create an input for.bufferSize
- The size of the buffer to hold for data incoming on this segment.hasData
- A Semaphore that will have `release` called when data is available.endOffset
- The offset up to which the segment can be read.- Returns:
- New instance of the EventSegmentReader for reading.
-
createEventReaderForSegment
EventSegmentReader createEventReaderForSegment(Segment segment, int bufferSize)
Opens an existing segment for reading. This operation will fail if the segment does not exist. This operation may be called multiple times on the same segment from the same client (i.e., there can be concurrent Event Readers in the same process space). This operation additionally takes a buffer size parameter. This size is used to allocate buffer space for the bytes this reader reads from the segment. It is important to control the buffer size, e.g., when randomly reading events withEventStreamReader.fetchEvent(EventPointer)
- Parameters:
segment
- The segment to create an input for.bufferSize
- Size of the read buffer.- Returns:
- A segment event reader.
-
createEventReaderForSegment
EventSegmentReader createEventReaderForSegment(Segment segment, long startOffset, int bufferSize)
Opens an existing segment for reading. This operation will fail if the segment does not exist. This operation may be called multiple times on the same segment from the same client (i.e., there can be concurrent Event Readers in the same process space). This operation additionally takes a buffer size parameter. This size is used to allocate buffer space for the bytes this reader reads from the segment. It is important to control the buffer size and startOffset e.g., when randomly reading events withStreamManager.fetchEvent(EventPointer, Serializer)
- Parameters:
segment
- The segment to create an input for.startOffset
- the start offset of the segment.bufferSize
- Size of the read buffer.- Returns:
- A segment event reader.
-
-