Package com.linkedin.venice.client.store
Class AbstractAvroStoreClient<K,V>
java.lang.Object
com.linkedin.venice.client.store.InternalAvroStoreClient<K,V>
com.linkedin.venice.client.store.AbstractAvroStoreClient<K,V>
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,
,V> AvroGenericStoreClient<K,
,V> Closeable
,AutoCloseable
- Direct Known Subclasses:
AvroGenericStoreClientImpl
,AvroSpecificStoreClientImpl
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final String
protected RecordSerializer<ByteBuffer>
protected RecordSerializer<K>
protected RecordSerializer<ByteBuffer>
protected final boolean
static final String
static final String
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
AbstractAvroStoreClient
(TransportClient transportClient, boolean needSchemaReader, ClientConfig clientConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
The behavior of READ apis will be non-deterministic after `close` function is called.void
compute
(ComputeRequestWrapper computeRequest, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) protected RecordSerializer<K>
Clients using different protocols for deserialized data (e.g VSON, Proto, etc) can override this method to serialize the respective POJO to Avro bytesget
(K key, Optional<ClientStats> stats, long preRequestTimeInNS) protected final ClientConfig
protected String
abstract RecordDeserializer<V>
getDataRecordDeserializer
(int schemaId) static Executor
org.apache.avro.Schema
Get key schema.org.apache.avro.Schema
Deprecated.CompletableFuture<byte[]>
getRaw
(String requestPath, Optional<ClientStats> stats, long preRequestTimeInNS) protected Optional<org.apache.avro.Schema>
getRequestPathByKey
(K key) protected abstract AbstractAvroStoreClient<K,
V> To avoid cycle dependency, we need to initialize another store client for schema reader.protected TransportClient
protected static boolean
handleCallbackForEmptyKeySet
(Collection<?> keys, StreamingCallback callback) boolean
void
start()
void
This method is mainly for internal use.void
streamingBatchGet
(Set<K> keys, StreamingCallback<K, V> callback) Streaming interface forAvroGenericStoreClient.batchGet(Set)
.toString()
static <T,
K> T tryToDeserializeWithVerboseLogging
(RecordDeserializer<T> dataDeserializer, ByteBuffer data, int writerSchemaId, K key, RecordSerializer<K> keySerializer, SchemaReader schemaReader, org.apache.logging.log4j.Logger LOGGER) Methods inherited from class com.linkedin.venice.client.store.InternalAvroStoreClient
computeWithKeyPrefixFilter, get, getRaw
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface com.linkedin.venice.client.store.AvroGenericReadComputeStoreClient
compute, compute, compute, compute
Methods inherited from interface com.linkedin.venice.client.store.AvroGenericStoreClient
batchGet, get, streamingBatchGet
-
Field Details
-
TYPE_STORAGE
- See Also:
-
TYPE_COMPUTE
- See Also:
-
B64_FORMAT
- See Also:
-
needSchemaReader
protected final boolean needSchemaReader -
keySerializer
-
multiGetRequestSerializer
-
computeRequestClientKeySerializer
-
-
Constructor Details
-
AbstractAvroStoreClient
protected AbstractAvroStoreClient(TransportClient transportClient, boolean needSchemaReader, ClientConfig clientConfig)
-
-
Method Details
-
getDefaultDeserializationExecutor
-
getStoreName
-
getClientConfig
-
getTransportClient
-
getSchemaReader
-
getDeserializationExecutor
- Overrides:
getDeserializationExecutor
in classInternalAvroStoreClient<K,
V>
-
getComputeRequestPath
-
createKeySerializer
Clients using different protocols for deserialized data (e.g VSON, Proto, etc) can override this method to serialize the respective POJO to Avro bytes- Returns:
- A serializer for key objects to Avro bytes
-
getRequestPathByKey
- Throws:
VeniceClientException
-
get
public CompletableFuture<V> get(K key, Optional<ClientStats> stats, long preRequestTimeInNS) throws VeniceClientException - Specified by:
get
in classInternalAvroStoreClient<K,
V> - Throws:
VeniceClientException
-
getRaw
public CompletableFuture<byte[]> getRaw(String requestPath, Optional<ClientStats> stats, long preRequestTimeInNS) - Specified by:
getRaw
in classInternalAvroStoreClient<K,
V>
-
tryToDeserializeWithVerboseLogging
public static <T,K> T tryToDeserializeWithVerboseLogging(RecordDeserializer<T> dataDeserializer, ByteBuffer data, int writerSchemaId, K key, RecordSerializer<K> keySerializer, SchemaReader schemaReader, org.apache.logging.log4j.Logger LOGGER) -
isProjectionFieldValidationEnabled
public boolean isProjectionFieldValidationEnabled() -
compute
public void compute(ComputeRequestWrapper computeRequest, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) throws VeniceClientException- Throws:
VeniceClientException
-
start
- Throws:
VeniceClientException
-
startWithExceptionThrownWhenFail
public void startWithExceptionThrownWhenFail()Description copied from class:InternalAvroStoreClient
This method is mainly for internal use. The default {#start()} method will not throw an exception if the client fails to start since it is a best effort to make it compatible with the existing usage of the client (customers can trigger the start() method even before the dependency is ready). This method is mainly used to the internal startupAware callback, and it will indicate the startup failure by throwing an exception.- Specified by:
startWithExceptionThrownWhenFail
in classInternalAvroStoreClient<K,
V>
-
close
public void close()The behavior of READ apis will be non-deterministic after `close` function is called. -
getReaderSchema
-
getStoreClientForSchemaReader
To avoid cycle dependency, we need to initialize another store client for schema reader.- Returns:
- Throws:
VeniceClientException
-
getDataRecordDeserializer
public abstract RecordDeserializer<V> getDataRecordDeserializer(int schemaId) throws VeniceClientException - Throws:
VeniceClientException
-
toString
-
getKeySchema
public org.apache.avro.Schema getKeySchema()Description copied from interface:AvroGenericStoreClient
Get key schema. -
getLatestValueSchema
Deprecated.Description copied from interface:AvroGenericStoreClient
Get the latest value schema known in current store client. This function doesn't guarantee it will return the latest schema if you add a new value schema when current store client is running. -
streamingBatchGet
public void streamingBatchGet(Set<K> keys, StreamingCallback<K, V> callback) throws VeniceClientExceptionDescription copied from interface:AvroGenericStoreClient
Streaming interface forAvroGenericStoreClient.batchGet(Set)
. You can find more info inStreamingCallback
.- Throws:
VeniceClientException
-
handleCallbackForEmptyKeySet
protected static boolean handleCallbackForEmptyKeySet(Collection<?> keys, StreamingCallback callback)
-