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 Object
implements RecordStreamDecoder
Streaming callback for batch-get/compute.
Since data chunk returned by
D2TransportClient
doesn't respect chunk-size associated with each
chunk sent by Venice Router, here is leveraging ReadEnvelopeChunkedDeserializer
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 using
D2TransportClient
, and both the record deserialization and application's callback will be executed in
Venice thread pool: deserializationExecutor
,-
Constructor Summary
ConstructorDescriptionAbstractRecordStreamDecoder
(List<K> keyList, TrackingStreamingCallback<K, V> callback, Executor deserializationExecutor) -
Method Summary
Modifier and TypeMethodDescriptionprotected 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
(Optional<VeniceClientException> exception) This will be invoked when the response is fully completed.void
onDataReceived
(ByteBuffer chunk) This will be invoked when a new data chunk is available.void
onHeaderReceived
(Map<String, String> headers) This will be invoked when headers are available.
-
Constructor Details
-
AbstractRecordStreamDecoder
-
-
Method Details
-
onHeaderReceived
Description copied from interface:TransportClientStreamingCallback
This will be invoked when headers are available.- Specified by:
onHeaderReceived
in interfaceTransportClientStreamingCallback
-
onDataReceived
Description copied from interface:TransportClientStreamingCallback
This will be invoked when a new data chunk is available.- Specified by:
onDataReceived
in interfaceTransportClientStreamingCallback
-
onCompletion
Description copied from interface:TransportClientStreamingCallback
This will be invoked when the response is fully completed. When any error happens, will contain the underlying exception.- Specified by:
onCompletion
in interfaceTransportClientStreamingCallback
-
getEnvelopeDeserializer
-
getValueRecord
-
getKeyIndex
-