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> Closeable,AutoCloseable
- Direct Known Subclasses:
DualReadAvroGenericStoreClient,LoadControlledAvroGenericStoreClient,RetriableAvroGenericStoreClient,StatsAvroGenericStoreClient
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. Check
Layer -1:
Layer 0:
Layer 1:
Layer 2:
Layer 3:
Layer 4:
utils class:
Interactions between these class for some flows: https://swimlanes.io/u/iHTCBvlf0
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. Check
ClientFactory.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 implements AvroGenericReadComputeStoreClient => The abstract class
implementing above interfaces for fast-client. All other internal implementations of different tiers should extend
this class.
Layer 1:
DispatchingAvroGenericStoreClient extends InternalAvroStoreClient => in charge of routing and
serialization/de-serialization
Layer 2:
RetriableAvroGenericStoreClient extends DelegatingAvroStoreClient => Adds optional retry ability on
top of DispatchingAvroGenericStoreClient
Layer 3:
StatsAvroGenericStoreClient extends DelegatingAvroStoreClient => 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 extends DelegatingAvroStoreClient => Adds an extra read via thin
client on top of Layer 3.
utils class:
DelegatingAvroStoreClient extends InternalAvroStoreClient => 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
ConstructorsConstructorDescriptionDelegatingAvroStoreClient(InternalAvroStoreClient<K, V> delegate, ClientConfig clientConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Release the internal resources.protected voidcompute(ComputeRequestContext<K, V> requestContext, ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, ComputeGenericRecord> callback, long preRequestTimeInNS) compute(Optional<ClientStats> stats, Optional<ClientStats> streamingStats, AvroGenericReadComputeStoreClient computeStoreClient, long preRequestTimeInNS) protected CompletableFuture<V>get(GetRequestContext<K> requestContext, K key) org.apache.avro.SchemaGet key schema.org.apache.avro.SchemaDeprecated.voidstart()protected voidstreamingBatchGet(BatchGetRequestContext<K, V> requestContext, Set<K> keys, StreamingCallback<K, V> callback) Methods inherited from class com.linkedin.venice.fastclient.InternalAvroStoreClient
batchGet, batchGet, compute, computeWithKeyPrefixFilter, get, isProjectionFieldValidationEnabled, streamingBatchGet, streamingBatchGet, streamingBatchGetMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.client.store.AvroGenericReadComputeStoreClient
compute, compute, compute, computeAggregationMethods inherited from interface com.linkedin.venice.client.store.AvroGenericStoreClient
get
-
Constructor Details
-
DelegatingAvroStoreClient
-
-
Method Details
-
getClientConfig
- Specified by:
getClientConfigin classInternalAvroStoreClient<K,V>
-
getSchemaReader
-
get
protected CompletableFuture<V> get(GetRequestContext<K> requestContext, K key) throws VeniceClientException - Specified by:
getin classInternalAvroStoreClient<K,V> - Throws:
VeniceClientException
-
streamingBatchGet
protected void streamingBatchGet(BatchGetRequestContext<K, V> requestContext, Set<K> keys, StreamingCallback<K, V> callback) - Specified by:
streamingBatchGetin classInternalAvroStoreClient<K,V>
-
compute
protected void compute(ComputeRequestContext<K, V> requestContext, ComputeRequestWrapper computeRequestWrapper, Set<K> keys, org.apache.avro.Schema resultSchema, StreamingCallback<K, throws VeniceClientExceptionComputeGenericRecord> callback, long preRequestTimeInNS) - Specified by:
computein classInternalAvroStoreClient<K,V> - Throws:
VeniceClientException
-
start
- Throws:
VeniceClientException
-
close
public void close()Description copied from interface:AvroGenericStoreClientRelease the internal resources. -
getStoreName
-
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. -
compute
public ComputeRequestBuilder<K> compute(Optional<ClientStats> stats, Optional<ClientStats> streamingStats, AvroGenericReadComputeStoreClient computeStoreClient, long preRequestTimeInNS) throws VeniceClientException - Throws:
VeniceClientException
-