Package com.linkedin.venice.fastclient
Class InternalAvroStoreClient<K,V>
java.lang.Object
com.linkedin.venice.fastclient.InternalAvroStoreClient<K,V>
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,
,V> AvroGenericStoreClient<K,
,V> Closeable
,AutoCloseable
- Direct Known Subclasses:
DelegatingAvroStoreClient
,DispatchingAvroGenericStoreClient
public abstract class InternalAvroStoreClient<K,V>
extends Object
implements AvroGenericReadComputeStoreClient<K,V>
All the internal implementations of different tiers should extend this class.
This class adds in
RequestContext
object for the communication among different tiers.-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected CompletableFuture<Map<K,
V>> final CompletableFuture<Map<K,
V>> Get the values associated with the given keys and return them in a map of keys to values.final void
compute
(ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) protected abstract void
compute
(ComputeRequestContext<K, V> requestContext, ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) final void
computeWithKeyPrefixFilter
(byte[] keyPrefix, ComputeRequestWrapper computeRequestWrapper, StreamingCallback<org.apache.avro.generic.GenericRecord, org.apache.avro.generic.GenericRecord> callback) protected abstract CompletableFuture<V>
get
(GetRequestContext requestContext, K key) Lookup the value by given key, and get(key).get() will return null if it doesn't exist.abstract ClientConfig
final boolean
protected final CompletableFuture<VeniceResponseMap<K,
V>> streamingBatchGet
(BatchGetRequestContext<K, V> requestContext, Set<K> keys) protected abstract void
streamingBatchGet
(BatchGetRequestContext<K, V> requestContext, Set<K> keys, StreamingCallback<K, V> callback) final CompletableFuture<VeniceResponseMap<K,
V>> streamingBatchGet
(Set<K> keys) Get the values associated with the given keys and return them in a map of keys to values.final void
streamingBatchGet
(Set<K> keys, StreamingCallback<K, V> callback) Streaming interface forAvroGenericStoreClient.batchGet(Set)
.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, getSchemaReader
Methods inherited from interface com.linkedin.venice.client.store.AvroGenericStoreClient
close, get, getKeySchema, getLatestValueSchema, getStoreName, start
-
Constructor Details
-
InternalAvroStoreClient
public InternalAvroStoreClient()
-
-
Method Details
-
getClientConfig
-
isProjectionFieldValidationEnabled
public final boolean isProjectionFieldValidationEnabled()- Specified by:
isProjectionFieldValidationEnabled
in interfaceAvroGenericReadComputeStoreClient<K,
V>
-
get
Description copied from interface:AvroGenericStoreClient
Lookup the value by given key, and get(key).get() will return null if it doesn't exist. For now, if any backend error/exception happens, get(Object key).get() will throwExecutionException
, which is a wrapper of the real exception.- Specified by:
get
in interfaceAvroGenericStoreClient<K,
V> - Returns:
- Throws:
VeniceClientException
-
get
protected abstract CompletableFuture<V> get(GetRequestContext requestContext, K key) throws VeniceClientException - Throws:
VeniceClientException
-
batchGet
Description copied from interface:AvroGenericStoreClient
Get the values associated with the given keys and return them in a map of keys to values. Note that the returned map will only contain entries for the keys which have a value associated with them.- Specified by:
batchGet
in interfaceAvroGenericStoreClient<K,
V> - Returns:
- Throws:
VeniceClientException
-
batchGet
protected CompletableFuture<Map<K,V>> batchGet(BatchGetRequestContext<K, V> requestContext, Set<K> keys) throws VeniceClientException- Throws:
VeniceClientException
-
streamingBatchGet
public final 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
.- Specified by:
streamingBatchGet
in interfaceAvroGenericStoreClient<K,
V> - Throws:
VeniceClientException
-
streamingBatchGet
public final CompletableFuture<VeniceResponseMap<K,V>> streamingBatchGet(Set<K> keys) throws VeniceClientException Description copied from interface:AvroGenericStoreClient
Get the values associated with the given keys and return them in a map of keys to values. When time-out happens for the following invocation:streamingBatchGet(keys).get(waitingTime, unit);
This function will return the available response instead of throwing aTimeoutException
. It means this function could return either full response or partial response.- Specified by:
streamingBatchGet
in interfaceAvroGenericStoreClient<K,
V> - Returns:
- Throws:
VeniceClientException
-
streamingBatchGet
protected final CompletableFuture<VeniceResponseMap<K,V>> streamingBatchGet(BatchGetRequestContext<K, V> requestContext, Set<K> keys) -
streamingBatchGet
protected abstract void streamingBatchGet(BatchGetRequestContext<K, V> requestContext, Set<K> keys, StreamingCallback<K, V> callback) -
compute
public final void compute(ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) throws VeniceClientException- Specified by:
compute
in interfaceAvroGenericReadComputeStoreClient<K,
V> - Throws:
VeniceClientException
-
compute
protected abstract void compute(ComputeRequestContext<K, V> requestContext, ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, throws VeniceClientExceptionComputeGenericRecord> callback, long preRequestTimeInNS) - Throws:
VeniceClientException
-
computeWithKeyPrefixFilter
public final void computeWithKeyPrefixFilter(byte[] keyPrefix, ComputeRequestWrapper computeRequestWrapper, StreamingCallback<org.apache.avro.generic.GenericRecord, org.apache.avro.generic.GenericRecord> callback) - Specified by:
computeWithKeyPrefixFilter
in interfaceAvroGenericReadComputeStoreClient<K,
V>
-