Package com.linkedin.venice.client.store
Class StatTrackingStoreClient<K,V>
- java.lang.Object
-
- com.linkedin.venice.client.store.InternalAvroStoreClient<K,V>
-
- com.linkedin.venice.client.store.DelegatingStoreClient<K,V>
-
- com.linkedin.venice.client.store.StatTrackingStoreClient<K,V>
-
- Type Parameters:
V
-
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,V>
,AvroGenericStoreClient<K,V>
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
SpecificStatTrackingStoreClient
public class StatTrackingStoreClient<K,V> extends DelegatingStoreClient<K,V>
This class is used to handle all the metric related logic.
-
-
Constructor Summary
Constructors Constructor Description StatTrackingStoreClient(InternalAvroStoreClient<K,V> innerStoreClient, ClientConfig clientConfig)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.concurrent.CompletableFuture<java.util.Map<K,V>>
batchGet(java.util.Set<K> keys)
Get the values associated with the given keys and return them in a map of keys to values.ComputeRequestBuilder<K>
compute()
This API allows performing transformations (projection, vector arithmetic and aggregations like count) on the values associated with the given set of keys.void
compute(ComputeRequestWrapper computeRequestWrapper, java.util.Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K,ComputeGenericRecord> callback, long preRequestTimeInNS)
java.util.concurrent.CompletableFuture<V>
get(K key)
Lookup the value by given key, and get(key).get() will return null if it doesn't exist.java.util.concurrent.CompletableFuture<byte[]>
getRaw(java.lang.String requestPath)
static <T> java.util.function.BiFunction<? super T,java.lang.Throwable,? extends T>
getStatCallback(ClientStats clientStats, long startTimeInNS)
static void
handleStoreExceptionInternally(java.lang.Throwable throwable)
void
recordRetryCount(RequestType requestType)
java.util.concurrent.CompletableFuture<VeniceResponseMap<K,V>>
streamingBatchGet(java.util.Set<K> keys)
Get the values associated with the given keys and return them in a map of keys to values.void
streamingBatchGet(java.util.Set<K> keys, StreamingCallback<K,V> callback)
Streaming interface forAvroGenericStoreClient.batchGet(Set)
.java.lang.String
toString()
-
Methods inherited from class com.linkedin.venice.client.store.DelegatingStoreClient
close, compute, computeWithKeyPrefixFilter, get, getDeserializationExecutor, getInnerStoreClient, getKeySchema, getLatestValueSchema, getRaw, getSchemaReader, getStoreName, isProjectionFieldValidationEnabled, start
-
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
-
Methods inherited from interface com.linkedin.venice.client.store.AvroGenericStoreClient
get
-
-
-
-
Constructor Detail
-
StatTrackingStoreClient
public StatTrackingStoreClient(InternalAvroStoreClient<K,V> innerStoreClient, ClientConfig clientConfig)
-
-
Method Detail
-
get
public java.util.concurrent.CompletableFuture<V> get(K key)
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>
- Overrides:
get
in classInternalAvroStoreClient<K,V>
- Returns:
-
getRaw
public java.util.concurrent.CompletableFuture<byte[]> getRaw(java.lang.String requestPath)
- Overrides:
getRaw
in classInternalAvroStoreClient<K,V>
-
batchGet
public java.util.concurrent.CompletableFuture<java.util.Map<K,V>> batchGet(java.util.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. 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>
- Overrides:
batchGet
in classDelegatingStoreClient<K,V>
- Returns:
- Throws:
VeniceClientException
-
streamingBatchGet
public java.util.concurrent.CompletableFuture<VeniceResponseMap<K,V>> streamingBatchGet(java.util.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.- Returns:
- Throws:
VeniceClientException
-
recordRetryCount
public void recordRetryCount(RequestType requestType)
-
streamingBatchGet
public void streamingBatchGet(java.util.Set<K> keys, StreamingCallback<K,V> callback) throws VeniceClientException
Description copied from interface:AvroGenericStoreClient
Streaming interface forAvroGenericStoreClient.batchGet(Set)
. You can find more info inStreamingCallback
.- Specified by:
streamingBatchGet
in interfaceAvroGenericStoreClient<K,V>
- Overrides:
streamingBatchGet
in classDelegatingStoreClient<K,V>
- Throws:
VeniceClientException
-
compute
public void compute(ComputeRequestWrapper computeRequestWrapper, java.util.Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K,ComputeGenericRecord> callback, long preRequestTimeInNS) throws VeniceClientException
- Specified by:
compute
in interfaceAvroGenericReadComputeStoreClient<K,V>
- Overrides:
compute
in classDelegatingStoreClient<K,V>
- Throws:
VeniceClientException
-
compute
public ComputeRequestBuilder<K> compute() throws VeniceClientException
Description copied from interface:AvroGenericStoreClient
This API allows performing transformations (projection, vector arithmetic and aggregations like count) on the values associated with the given set of keys. Check outComputeRequestBuilder
for details on the available operations.- Throws:
VeniceClientException
- See Also:
ComputeRequestBuilder
-
getStatCallback
public static <T> java.util.function.BiFunction<? super T,java.lang.Throwable,? extends T> getStatCallback(ClientStats clientStats, long startTimeInNS)
-
handleStoreExceptionInternally
public static void handleStoreExceptionInternally(java.lang.Throwable throwable)
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
-