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 Stringprotected RecordSerializer<ByteBuffer>protected RecordSerializer<K>protected RecordSerializer<ByteBuffer>protected final booleanstatic final Stringstatic final String -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedAbstractAvroStoreClient(TransportClient transportClient, boolean needSchemaReader, ClientConfig clientConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()The behavior of READ apis will be non-deterministic after `close` function is called.voidcompute(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 ClientConfigprotected Stringabstract RecordDeserializer<V>getDataRecordDeserializer(int schemaId) protected RecordDeserializer<V>getDataRecordDeserializerFromCache(int schemaId) static Executororg.apache.avro.SchemaGet key schema.org.apache.avro.SchemaDeprecated.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 TransportClientprotected static booleanhandleCallbackForEmptyKeySet(Collection<?> keys, StreamingCallback callback) booleanvoidstart()voidThis method is mainly for internal use.voidstreamingBatchGet(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, getStreamingCallbackMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface com.linkedin.venice.client.store.AvroGenericReadComputeStoreClient
compute, compute, compute, compute, computeAggregationMethods 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:
getDeserializationExecutorin 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:
getin classInternalAvroStoreClient<K,V> - Throws:
VeniceClientException
-
getRaw
public CompletableFuture<byte[]> getRaw(String requestPath, Optional<ClientStats> stats, long preRequestTimeInNS) - Specified by:
getRawin 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:InternalAvroStoreClientThis 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:
startWithExceptionThrownWhenFailin 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:AvroGenericStoreClientGet key schema. -
getLatestValueSchema
Deprecated.Description copied from interface:AvroGenericStoreClientGet 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:AvroGenericStoreClientStreaming interface forAvroGenericStoreClient.batchGet(Set). You can find more info inStreamingCallback.- Throws:
VeniceClientException
-
getDataRecordDeserializerFromCache
-
handleCallbackForEmptyKeySet
protected static boolean handleCallbackForEmptyKeySet(Collection<?> keys, StreamingCallback callback)
-