Class AbstractStoreMetadata
- All Implemented Interfaces:
StoreMetadata,SchemaReader,Closeable,AutoCloseable
- Direct Known Subclasses:
RequestBasedMetadata
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected RunnablebuildStoreConfigChangeCallback(StoreConfigSnapshot previous, StoreConfigSnapshot current) Return aRunnablethat will notify the registered store-config-change listeners of the supplied(previous, current)transition.protected RunnablebuildVersionSwitchCallback(int previousVersion, int newVersion) Return aRunnablethat will notify the registered version-switch listeners of the supplied(previousVersion, newVersion)transition.voidclose()protected voidfireStoreConfigChange(StoreConfigSnapshot previous, StoreConfigSnapshot current) Notify the registered store-config-change listeners of a transition, but only ifpreviousandcurrentdiffer — so callers may invoke this on every refresh without diffing first.protected voidfireVersionSwitch(int previousVersion, int newVersion) Notify the registered version-switch listeners of a transition.intgetCompressor(CompressionStrategy compressionStrategy, int version, CompressorFactory compressorFactory, Map<Integer, ByteBuffer> versionZstdDictionaryMap) intgetPartitionId(int version, byte[] key) getReplica(long requestId, int groupId, int version, int partitionId, Set<String> excludedInstances) This function is expected to return fully qualified URI, such as: "https://fake.host:8888".voidRegister a callback that fires when the metadata refresh loop observes a change to the store-level config snapshot (e.g.voidRegister a callback that fires when the metadata refresh loop observes a change to the store's current serving version.<K> voidrouteRequest(RequestContext requestContext, RecordSerializer<K> keySerializer) voidsetRoutingStrategy(AbstractClientRoutingStrategy routingStrategy) For testing only.voidsetRoutingStrategy(ClientRoutingStrategyType strategyType) trackHealthBasedOnRequestToInstance(String instance, int version, int partitionId, CompletableFuture<TransportClientResponse> transportFuture) Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface com.linkedin.venice.schema.SchemaReader
getKeySchema, getLatestUpdateSchema, getLatestValueSchema, getLatestValueSchemaId, getLatestValueSchemaId, getUpdateSchema, getValueSchema, getValueSchemaIdMethods inherited from interface com.linkedin.venice.fastclient.meta.StoreMetadata
getClusterName, getCompressionStrategy, getCompressor, getCurrentStoreVersion, getPartitionId, getReplicas, isReady, start
-
Field Details
-
routingStrategy
-
storeName
-
-
Constructor Details
-
AbstractStoreMetadata
-
-
Method Details
-
setRoutingStrategy
-
setRoutingStrategy
For testing only. -
getStoreName
- Specified by:
getStoreNamein interfaceStoreMetadata
-
getPartitionId
public int getPartitionId(int version, byte[] key) - Specified by:
getPartitionIdin interfaceStoreMetadata
-
getReplica
public String getReplica(long requestId, int groupId, int version, int partitionId, Set<String> excludedInstances) Description copied from interface:StoreMetadataThis function is expected to return fully qualified URI, such as: "https://fake.host:8888".- Specified by:
getReplicain interfaceStoreMetadata
-
trackHealthBasedOnRequestToInstance
public ChainedCompletableFuture<Integer,Integer> trackHealthBasedOnRequestToInstance(String instance, int version, int partitionId, CompletableFuture<TransportClientResponse> transportFuture) - Specified by:
trackHealthBasedOnRequestToInstancein interfaceStoreMetadata
-
getInstanceHealthMonitor
- Specified by:
getInstanceHealthMonitorin interfaceStoreMetadata
-
getBatchGetLimit
public int getBatchGetLimit()- Specified by:
getBatchGetLimitin interfaceStoreMetadata
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Throws:
IOException
-
getCompressor
public VeniceCompressor getCompressor(CompressionStrategy compressionStrategy, int version, CompressorFactory compressorFactory, Map<Integer, ByteBuffer> versionZstdDictionaryMap) -
routeRequest
- Specified by:
routeRequestin interfaceStoreMetadata
-
registerVersionSwitchListener
Description copied from interface:StoreMetadataRegister a callback that fires when the metadata refresh loop observes a change to the store's current serving version. The callback is invoked after the new version has been committed to the local cache. SeeStoreVersionSwitchListenerfor threading and exception semantics.Registration timing. Listeners must be registered before
StoreMetadata.start()to observe the initial transition committed by the first refresh. Listeners registered afterstart()returns observe only subsequent transitions.listenermust not benull. Default implementations ofStoreMetadata(e.g. test fakes) treat the registration itself as a no-op but still enforce the non-null contract so behavior is consistent with the canonicalAbstractStoreMetadataimplementation.- Specified by:
registerVersionSwitchListenerin interfaceStoreMetadata
-
buildVersionSwitchCallback
Return aRunnablethat will notify the registered version-switch listeners of the supplied(previousVersion, newVersion)transition.Build the
Runnableinside the synchronized region that observed the transition, and run it after the region has been exited so that listeners may safely call back into this metadata. -
fireVersionSwitch
protected void fireVersionSwitch(int previousVersion, int newVersion) Notify the registered version-switch listeners of a transition. Each listener is invoked in registration order; exceptions are caught and logged so that one failing listener cannot prevent others from running. -
registerStoreConfigChangeListener
Description copied from interface:StoreMetadataRegister a callback that fires when the metadata refresh loop observes a change to the store-level config snapshot (e.g. operator-drivenExternalStorageReadModeflip). The callback is invoked after the new snapshot has been committed to the local cache. SeeStoreConfigChangeListenerfor threading and exception semantics.Registration timing. Same as
StoreMetadata.registerVersionSwitchListener(com.linkedin.venice.client.store.listeners.StoreVersionSwitchListener)— register beforeStoreMetadata.start()to observe the initial snapshot; post-start registration observes only subsequent changes.listenermust not benull. Default implementations ofStoreMetadata(e.g. test fakes) treat the registration itself as a no-op but still enforce the non-null contract so behavior is consistent with the canonicalAbstractStoreMetadataimplementation.- Specified by:
registerStoreConfigChangeListenerin interfaceStoreMetadata
-
buildStoreConfigChangeCallback
protected Runnable buildStoreConfigChangeCallback(StoreConfigSnapshot previous, StoreConfigSnapshot current) Return aRunnablethat will notify the registered store-config-change listeners of the supplied(previous, current)transition. -
fireStoreConfigChange
Notify the registered store-config-change listeners of a transition, but only ifpreviousandcurrentdiffer — so callers may invoke this on every refresh without diffing first. Each listener is invoked in registration order; exceptions are caught and logged so that one failing listener cannot prevent others from running.- Parameters:
previous- prior snapshot, ornullif no prior snapshot existedcurrent- new snapshot; must not benull- Throws:
IllegalArgumentException- ifcurrentisnull
-