Interface AvroGenericStoreClient<K,V>
- Type Parameters:
V-
- All Superinterfaces:
AutoCloseable,Closeable
- All Known Subinterfaces:
AvroGenericReadComputeStoreClient<K,,V> AvroSpecificStoreClient<K,,V> DaVinciClient<K,,V> SeekableDaVinciClient<K,V>
- All Known Implementing Classes:
AbstractAvroStoreClient,AvroBlackHoleResponseStoreClientImpl,AvroGenericDaVinciClient,AvroGenericSeekableDaVinciClient,AvroGenericStoreClientImpl,AvroSpecificDaVinciClient,AvroSpecificSeekableDaVinciClient,AvroSpecificStoreClientImpl,DelegatingAvroGenericDaVinciClient,DelegatingAvroStoreClient,DelegatingStoreClient,DispatchingAvroGenericStoreClient,DispatchingAvroSpecificStoreClient,DispatchingVsonStoreClient,DualReadAvroGenericStoreClient,DualReadAvroSpecificStoreClient,InternalAvroStoreClient,InternalAvroStoreClient,LoadControlledAvroGenericStoreClient,LoadControlledAvroSpecificStoreClient,LoggingTrackingStoreClient,RetriableAvroGenericStoreClient,RetriableAvroSpecificStoreClient,RetriableStoreClient,SpecificLoggingTrackingStoreClient,SpecificRetriableStoreClient,SpecificStatTrackingStoreClient,StatsAvroGenericDaVinciClient,StatsAvroGenericStoreClient,StatsAvroSpecificDaVinciClient,StatsAvroSpecificStoreClient,StatTrackingStoreClient,VersionSpecificAvroGenericDaVinciClient,VsonGenericStoreClientImpl
-
Method Summary
Modifier and TypeMethodDescriptiondefault CompletableFuture<Map<K,V>> Get the values associated with the given keys and return them in a map of keys to values.voidclose()Release the internal resources.compute()This API allows performing transformations (projection, vector arithmetic and aggregations like count) on the values associated with the given set of keys.default VdecompressAndDeserialize(ByteBuffer rawValue, int version, K key) Re-entry point for callers that obtained Venice-format raw value bytes from a path other than the standard Venice routing layer (e.g.Lookup the value by given key, and get(key).get() will return null if it doesn't exist.default CompletableFuture<V>Similar toget(Object)except that it allows passing in a instance, to minimize GC.org.apache.avro.SchemaDeprecated.This method is considered deprecated.org.apache.avro.SchemaDeprecated.This method is considered deprecated.default voidRegister aStoreConfigChangeListenerthat fires when the underlying metadata layer observes a change to the store-level config snapshot (e.g.default voidRegister aStoreVersionSwitchListenerthat fires when the underlying metadata layer observes a change to the store's current serving version.voidstart()default 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.voidstreamingBatchGet(Set<K> keys, StreamingCallback<K, V> callback) Streaming interface forbatchGet(Set).
-
Method Details
-
get
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.- Parameters:
key-- Returns:
- Throws:
VeniceClientException
-
get
Similar toget(Object)except that it allows passing in a instance, to minimize GC.- Throws:
VeniceClientException
-
batchGet
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.- Parameters:
keys-- Returns:
- Throws:
VeniceClientException
-
streamingBatchGet
default CompletableFuture<VeniceResponseMap<K,V>> streamingBatchGet(Set<K> keys) throws VeniceClientException 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.- Parameters:
keys-- Returns:
- Throws:
VeniceClientException
-
streamingBatchGet
Streaming interface forbatchGet(Set). You can find more info inStreamingCallback.- Parameters:
keys-callback-- Throws:
VeniceClientException
-
compute
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. Check outComputeRequestBuilderfor details on the available operations.- See Also:
-
start
- Throws:
VeniceClientException
-
close
void close()Release the internal resources.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable
-
getStoreName
String getStoreName() -
getKeySchema
Deprecated.This method is considered deprecated. Please useStoreSchemaFetcher.getKeySchema()to fetch key schema instead.Get key schema. -
getLatestValueSchema
Deprecated.This method is considered deprecated. Please useStoreSchemaFetcher.getLatestValueSchemaEntry()to fetch latest value schema instead.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. -
decompressAndDeserialize
default V decompressAndDeserialize(ByteBuffer rawValue, int version, K key) throws VeniceClientException Re-entry point for callers that obtained Venice-format raw value bytes from a path other than the standard Venice routing layer (e.g. an external storage system holding the same wire bytes) and want to run those bytes through the Fast Client's existing decompression + Avro deserialization pipeline without duplicating that logic.This entry point is Fast Client only — implemented by
com.linkedin.venice.fastclient.DispatchingAvroGenericStoreClientand forwarded by Fast Client'sDelegatingAvroStoreClientwrapper chain. Thin-client implementations inherit the throwing default because they lack the metadata refresh loop that supplies per-version compression state.Wire format.
rawValuemust hold the bytes exactly as Venice's storage layer writes them on disk / to an external sink: a 4-byte big-endianintwriter-schema id followed by the post-compression Avro-serialized value body. This matches whatcom.linkedin.venice.writer.DualWriteVeniceWriter#toRocksDbFormattedValueproduces for the dual-write external sink. The seam reads the schema id from those 4 bytes (so a store that has schema-evolved will still decode old payloads with their original writer schema), resolves the per-version compressor fromStoreMetadata, decompresses the remainder, and deserializes with the embedded schema id.- Parameters:
rawValue- the value payload, prefixed by a 4-byte big-endian writer-schema id. Must not benulland must have at least 4 bytes.version- the store version therawValuebytes were written under. Used to resolve the per-version compressor (including any ZSTD dictionary). Throws if the version is unknown to the metadata layer.key- the key that produced this value (used only for error messages and tracing)- Returns:
- the deserialized value
- Throws:
UnsupportedOperationException- by the default — including on every thin-client implementationVeniceClientException- if the version is unknown, or if decompression or deserialization failsIllegalArgumentException- ifrawValueisnullor shorter than 4 bytes
-
registerVersionSwitchListener
Register aStoreVersionSwitchListenerthat fires when the underlying metadata layer observes a change to the store's current serving version.Fast Client only. Thin-client implementations inherit the throwing default — there is no metadata refresh loop on the thin client, so version-switch transitions are not observable. See
com.linkedin.venice.fastclient.DispatchingAvroGenericStoreClientfor the Fast Client implementation andStoreVersionSwitchListenerfor threading and exception semantics.Registration timing. Listeners must be registered before
start()to observe the initial transition committed by the first metadata refresh. Listeners registered afterstart()returns observe only subsequent transitions (and re-entrant registration from inside a callback observes only subsequent transitions as well). Callers needing the initial transition should use the non-starting factory entry point (com.linkedin.venice.fastclient.factory.ClientFactory#getGenericStoreClient), register their listeners, then callstart()on the returned client.Registration is thread-safe.
- Throws:
IllegalArgumentException- iflistenerisnullUnsupportedOperationException- by the default — including on every thin-client implementation
-
registerStoreConfigChangeListener
Register aStoreConfigChangeListenerthat fires when the underlying metadata layer observes a change to the store-level config snapshot (e.g. operator-drivenexternalStorageReadModeflip).Fast Client only. Thin-client implementations inherit the throwing default. See
com.linkedin.venice.fastclient.DispatchingAvroGenericStoreClientfor the Fast Client implementation andStoreConfigChangeListenerfor threading and exception semantics.Registration timing. Same as
registerVersionSwitchListener(com.linkedin.venice.client.store.listeners.StoreVersionSwitchListener)— register beforestart()to observe the initial snapshot; post-start registration observes only subsequent changes.- Throws:
IllegalArgumentException- iflistenerisnullUnsupportedOperationException- by the default — including on every thin-client implementation
-