Package com.linkedin.venice.fastclient
Class DispatchingAvroGenericStoreClient<K,V>
- java.lang.Object
-
- com.linkedin.venice.fastclient.InternalAvroStoreClient<K,V>
-
- com.linkedin.venice.fastclient.DispatchingAvroGenericStoreClient<K,V>
-
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,V>
,AvroGenericStoreClient<K,V>
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
DispatchingAvroSpecificStoreClient
,DispatchingVsonStoreClient
public class DispatchingAvroGenericStoreClient<K,V> extends InternalAvroStoreClient<K,V>
This class is in charge of routing and serialization/de-serialization.
-
-
Field Summary
Fields Modifier and Type Field Description protected StoreMetadata
metadata
protected StoreDeserializerCache<V>
storeDeserializerCache
-
Constructor Summary
Constructors Constructor Description DispatchingAvroGenericStoreClient(StoreMetadata metadata, ClientConfig config)
DispatchingAvroGenericStoreClient(StoreMetadata metadata, ClientConfig config, TransportClient transportClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Release the internal resources.protected void
compute(ComputeRequestContext<K,V> requestContext, ComputeRequestWrapper computeRequest, java.util.Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K,ComputeGenericRecord> callback, long preRequestTimeInNS)
protected java.util.concurrent.CompletableFuture<V>
get(GetRequestContext requestContext, K key)
ClientConfig
getClientConfig()
protected RecordDeserializer<V>
getDataRecordDeserializer(int schemaId)
org.apache.avro.Schema
getKeySchema()
Get key schema.protected RecordSerializer
getKeySerializer(org.apache.avro.Schema keySchema)
org.apache.avro.Schema
getLatestValueSchema()
Deprecated.protected RecordDeserializer<MultiGetResponseRecordV1>
getMultiGetResponseRecordDeserializer(int schemaId)
SchemaReader
getSchemaReader()
protected StoreMetadata
getStoreMetadata()
java.lang.String
getStoreName()
void
start()
protected void
streamingBatchGet(BatchGetRequestContext<K,V> requestContext, java.util.Set<K> keys, StreamingCallback<K,V> callback)
This is the main implementation of the "streaming" version of batch get.-
Methods inherited from class com.linkedin.venice.fastclient.InternalAvroStoreClient
batchGet, batchGet, compute, computeWithKeyPrefixFilter, get, isProjectionFieldValidationEnabled, streamingBatchGet, streamingBatchGet, streamingBatchGet
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, 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
get
-
-
-
-
Field Detail
-
metadata
protected final StoreMetadata metadata
-
storeDeserializerCache
protected StoreDeserializerCache<V> storeDeserializerCache
-
-
Constructor Detail
-
DispatchingAvroGenericStoreClient
public DispatchingAvroGenericStoreClient(StoreMetadata metadata, ClientConfig config)
-
DispatchingAvroGenericStoreClient
public DispatchingAvroGenericStoreClient(StoreMetadata metadata, ClientConfig config, TransportClient transportClient)
-
-
Method Detail
-
getStoreMetadata
protected StoreMetadata getStoreMetadata()
-
getClientConfig
public ClientConfig getClientConfig()
- Specified by:
getClientConfig
in classInternalAvroStoreClient<K,V>
-
get
protected java.util.concurrent.CompletableFuture<V> get(GetRequestContext requestContext, K key) throws VeniceClientException
- Specified by:
get
in classInternalAvroStoreClient<K,V>
- Throws:
VeniceClientException
-
streamingBatchGet
protected void streamingBatchGet(BatchGetRequestContext<K,V> requestContext, java.util.Set<K> keys, StreamingCallback<K,V> callback)
This is the main implementation of the "streaming" version of batch get. As such this API doesn't provide a way to handle early exceptions. Further we tend to mix callback style and future style of asynchronous programming which makes it hard to make flexible and composable abstractions on top of this. For future enhancements we could consider returning a java stream , a bounded stream in the shape of a flux (project reactor), or one of the similar java 9 flow constructs.- Specified by:
streamingBatchGet
in classInternalAvroStoreClient<K,V>
- Parameters:
requestContext
-keys
-callback
-
-
compute
protected void compute(ComputeRequestContext<K,V> requestContext, ComputeRequestWrapper computeRequest, java.util.Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K,ComputeGenericRecord> callback, long preRequestTimeInNS) throws VeniceClientException
- Specified by:
compute
in classInternalAvroStoreClient<K,V>
- Throws:
VeniceClientException
-
getMultiGetResponseRecordDeserializer
protected RecordDeserializer<MultiGetResponseRecordV1> getMultiGetResponseRecordDeserializer(int schemaId)
-
getDataRecordDeserializer
protected RecordDeserializer<V> getDataRecordDeserializer(int schemaId) throws VeniceClientException
- Throws:
VeniceClientException
-
start
public void start() throws VeniceClientException
- Throws:
VeniceClientException
-
getKeySerializer
protected RecordSerializer getKeySerializer(org.apache.avro.Schema keySchema)
-
close
public void close()
Description copied from interface:AvroGenericStoreClient
Release the internal resources.
-
getStoreName
public java.lang.String getStoreName()
-
getKeySchema
public org.apache.avro.Schema getKeySchema()
Description copied from interface:AvroGenericStoreClient
Get key schema.
-
getLatestValueSchema
@Deprecated public org.apache.avro.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.
-
getSchemaReader
public SchemaReader getSchemaReader()
-
-