Class AbstractRecordStreamDecoder<ENVELOPE,K,V>
- java.lang.Object
-
- com.linkedin.venice.client.store.streaming.AbstractRecordStreamDecoder<ENVELOPE,K,V>
-
- Type Parameters:
ENVELOPE
-K
-V
-
- All Implemented Interfaces:
RecordStreamDecoder
,TransportClientStreamingCallback
- Direct Known Subclasses:
ComputeRecordStreamDecoder
,MultiGetRecordStreamDecoder
public abstract class AbstractRecordStreamDecoder<ENVELOPE,K,V> extends java.lang.Object implements RecordStreamDecoder
Streaming callback for batch-get/compute. Since data chunk returned byD2TransportClient
doesn't respect chunk-size associated with each chunk sent by Venice Router, here is leveragingReadEnvelopeChunkedDeserializer
to deserialize data chunks even with the data chunk contains partial record in a non-blocking way. The envelope deserialization will happen in TransportClient thread pool (R2 thread pool for example if usingD2TransportClient
, and both the record deserialization and application's callback will be executed in Venice thread pool:deserializationExecutor
,
-
-
Constructor Summary
Constructors Constructor Description AbstractRecordStreamDecoder(java.util.List<K> keyList, TrackingStreamingCallback<K,V> callback, java.util.concurrent.Executor deserializationExecutor)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract ReadEnvelopeChunkedDeserializer<ENVELOPE>
getEnvelopeDeserializer(int schemaId)
protected abstract int
getKeyIndex(ENVELOPE envelope)
protected abstract StreamingFooterRecordV1
getStreamingFooterRecord(ENVELOPE envelope)
protected abstract V
getValueRecord(ENVELOPE envelope, CompressionStrategy compression)
void
onCompletion(java.util.Optional<VeniceClientException> exception)
This will be invoked when the response is fully completed.void
onDataReceived(java.nio.ByteBuffer chunk)
This will be invoked when a new data chunk is available.void
onHeaderReceived(java.util.Map<java.lang.String,java.lang.String> headers)
This will be invoked when headers are available.
-
-
-
Constructor Detail
-
AbstractRecordStreamDecoder
public AbstractRecordStreamDecoder(java.util.List<K> keyList, TrackingStreamingCallback<K,V> callback, java.util.concurrent.Executor deserializationExecutor)
-
-
Method Detail
-
onHeaderReceived
public void onHeaderReceived(java.util.Map<java.lang.String,java.lang.String> headers)
Description copied from interface:TransportClientStreamingCallback
This will be invoked when headers are available.- Specified by:
onHeaderReceived
in interfaceTransportClientStreamingCallback
-
onDataReceived
public void onDataReceived(java.nio.ByteBuffer chunk)
Description copied from interface:TransportClientStreamingCallback
This will be invoked when a new data chunk is available.- Specified by:
onDataReceived
in interfaceTransportClientStreamingCallback
-
onCompletion
public void onCompletion(java.util.Optional<VeniceClientException> exception)
Description copied from interface:TransportClientStreamingCallback
This will be invoked when the response is fully completed. When any error happens, {@param exception} will contain the underlying exception.- Specified by:
onCompletion
in interfaceTransportClientStreamingCallback
-
getEnvelopeDeserializer
protected abstract ReadEnvelopeChunkedDeserializer<ENVELOPE> getEnvelopeDeserializer(int schemaId)
-
getStreamingFooterRecord
protected abstract StreamingFooterRecordV1 getStreamingFooterRecord(ENVELOPE envelope)
-
getValueRecord
protected abstract V getValueRecord(ENVELOPE envelope, CompressionStrategy compression)
-
getKeyIndex
protected abstract int getKeyIndex(ENVELOPE envelope)
-
-