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
,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
ConstructorDescriptionDelegatingAvroStoreClient
(InternalAvroStoreClient<K, V> delegate, ClientConfig clientConfig) -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
Release the internal resources.void
compute
(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 requestContext, K key) org.apache.avro.Schema
Get key schema.org.apache.avro.Schema
Deprecated.void
start()
protected void
streamingBatchGet
(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, 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 Details
-
DelegatingAvroStoreClient
-
-
Method Details
-
getClientConfig
- Specified by:
getClientConfig
in classInternalAvroStoreClient<K,
V>
-
getSchemaReader
-
get
protected 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, Set<K> keys, StreamingCallback<K, V> callback) - Specified by:
streamingBatchGet
in classInternalAvroStoreClient<K,
V>
-
compute
public 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:
compute
in classInternalAvroStoreClient<K,
V> - Throws:
VeniceClientException
-
start
- Throws:
VeniceClientException
-
close
public void close()Description copied from interface:AvroGenericStoreClient
Release the internal resources. -
getStoreName
-
getKeySchema
public org.apache.avro.Schema getKeySchema()Description copied from interface:AvroGenericStoreClient
Get key 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(Optional<ClientStats> stats, Optional<ClientStats> streamingStats, AvroGenericReadComputeStoreClient computeStoreClient, long preRequestTimeInNS) throws VeniceClientException - Throws:
VeniceClientException
-