Package com.linkedin.venice.fastclient
Class DelegatingAvroStoreClient<K,V>
- java.lang.Object
-
- com.linkedin.venice.fastclient.InternalAvroStoreClient<K,V>
-
- com.linkedin.venice.fastclient.DelegatingAvroStoreClient<K,V>
-
- All Implemented Interfaces:
AvroGenericReadComputeStoreClient<K,V>
,AvroGenericStoreClient<K,V>
,java.io.Closeable
,java.lang.AutoCloseable
- Direct Known Subclasses:
DualReadAvroGenericStoreClient
,RetriableAvroGenericStoreClient
,StatsAvroGenericStoreClient
public class DelegatingAvroStoreClient<K,V> extends InternalAvroStoreClient<K,V>
Inside Fast-Client, we choose to use n-tier architecture style to build a pipeline to separate different types of logic in different layer.
n-tier architecture => Having multiple layers where each layer wraps the next inner one. Each layer provides some functionality, e.g. stats collection, etc.
Fast-Client's layers include the below components. CheckClientFactory.getAndStartGenericStoreClient(com.linkedin.venice.fastclient.ClientConfig)
to figure out how the layers are put together for different requirements.
Layer -1:
AvroGenericStoreClient
,AvroGenericReadComputeStoreClient
=> interfaces: Borrowed from thin-client
Layer 0:
InternalAvroStoreClient
implementsAvroGenericReadComputeStoreClient
=> The abstract class implementing above interfaces for fast-client. All other internal implementations of different tiers should extend this class.
Layer 1:
DispatchingAvroGenericStoreClient
extendsInternalAvroStoreClient
=> in charge of routing and serialization/de-serialization
Layer 2:
RetriableAvroGenericStoreClient
extendsDelegatingAvroStoreClient
=> Adds optional retry ability on top of DispatchingAvroGenericStoreClient
Layer 3:
StatsAvroGenericStoreClient
extendsDelegatingAvroStoreClient
=> Adds stats on top of Layer 2 or Layer 1. There is no option to disable it, but if needed, can be disabled.
Layer 4:
DualReadAvroGenericStoreClient
extendsDelegatingAvroStoreClient
=> Adds an extra read via thin client on top of Layer 3.
utils class:
DelegatingAvroStoreClient
extendsInternalAvroStoreClient
=> Delegator pattern to not override all the functions in every superclass in a duplicate manner.
Interactions between these class for some flows: https://swimlanes.io/u/iHTCBvlf0
-
-
Constructor Summary
Constructors Constructor Description DelegatingAvroStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig clientConfig)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
close()
Release the internal resources.void
compute(ComputeRequestContext<K,V> requestContext, ComputeRequestWrapper computeRequestWrapper, java.util.Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K,ComputeGenericRecord> callback, long preRequestTimeInNS)
ComputeRequestBuilder<K>
compute(java.util.Optional<ClientStats> stats, java.util.Optional<ClientStats> streamingStats, AvroGenericReadComputeStoreClient computeStoreClient, long preRequestTimeInNS)
protected java.util.concurrent.CompletableFuture<V>
get(GetRequestContext requestContext, K key)
ClientConfig
getClientConfig()
org.apache.avro.Schema
getKeySchema()
Get key schema.org.apache.avro.Schema
getLatestValueSchema()
Deprecated.SchemaReader
getSchemaReader()
java.lang.String
getStoreName()
void
start()
protected void
streamingBatchGet(BatchGetRequestContext<K,V> requestContext, java.util.Set<K> keys, StreamingCallback<K,V> callback)
-
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
-
Methods inherited from interface com.linkedin.venice.client.store.AvroGenericStoreClient
get
-
-
-
-
Constructor Detail
-
DelegatingAvroStoreClient
public DelegatingAvroStoreClient(InternalAvroStoreClient<K,V> delegate, ClientConfig clientConfig)
-
-
Method Detail
-
getClientConfig
public ClientConfig getClientConfig()
- Specified by:
getClientConfig
in classInternalAvroStoreClient<K,V>
-
getSchemaReader
public SchemaReader getSchemaReader()
-
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)
- Specified by:
streamingBatchGet
in classInternalAvroStoreClient<K,V>
-
compute
public void compute(ComputeRequestContext<K,V> requestContext, ComputeRequestWrapper computeRequestWrapper, 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
-
start
public void start() throws VeniceClientException
- Throws:
VeniceClientException
-
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.
-
compute
public ComputeRequestBuilder<K> compute(java.util.Optional<ClientStats> stats, java.util.Optional<ClientStats> streamingStats, AvroGenericReadComputeStoreClient computeStoreClient, long preRequestTimeInNS) throws VeniceClientException
- Throws:
VeniceClientException
-
-