Class RequestBasedMetadata
- All Implemented Interfaces:
StoreMetadata,SchemaReader,Closeable,AutoCloseable
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final longstatic final longFields inherited from class com.linkedin.venice.fastclient.meta.AbstractStoreMetadata
routingStrategy, storeName -
Constructor Summary
ConstructorsConstructorDescriptionRequestBasedMetadata(ClientConfig clientConfig, D2TransportClient d2TransportClient) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()intgetCompressionStrategy(int version) Returns theCompressionStrategyconfigured for the given storeversion.getCompressor(CompressionStrategy compressionStrategy, int version) intorg.apache.avro.Schemaorg.apache.avro.SchemaGet the latest value schema id.intgetPartitionId(int version, ByteBuffer key) longgetReplicas(int version, int partitionId) org.apache.avro.SchemagetUpdateSchema(int valueSchemaId) org.apache.avro.SchemagetValueSchema(int id) intgetValueSchemaId(org.apache.avro.Schema schema) Return the schema ID of any schema that has the same parsing canonical form as the schema provided.static booleanisPartitionResourcesReady(String storeName, int version, int partitionCount, Map<Integer, List<String>> routingInfo) booleanisReady()voidsetD2ServiceDiscovery(D2ServiceDiscovery d2ServiceDiscovery) Used for test onlyvoidsetIsReadyLatch(CountDownLatch isReadyLatch) voidsetRefreshIntervalInSeconds(long refreshIntervalInSeconds) voidsetScheduler(ScheduledExecutorService scheduler) voidsetWarmUpInstancesFutures(Map<String, CompletableFuture> warmUpInstancesFutures) voidstart()static booleanwhetherToSwitchToFetchedCurrentVersion(String storeName, Set<Integer> activeVersions, AtomicInteger currentVersion, int fetchedCurrentVersion, int partitionCountForFetchedCurrentVersion, Map<Integer, List<String>> routingInfo) Methods inherited from class com.linkedin.venice.fastclient.meta.AbstractStoreMetadata
buildStoreConfigChangeCallback, buildVersionSwitchCallback, fireStoreConfigChange, fireVersionSwitch, getCompressor, getInstanceHealthMonitor, getPartitionId, getReplica, getStoreName, registerStoreConfigChangeListener, registerVersionSwitchListener, routeRequest, setRoutingStrategy, setRoutingStrategy, trackHealthBasedOnRequestToInstanceMethods 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
getLatestValueSchemaId
-
Field Details
-
DEFAULT_REFRESH_INTERVAL_IN_SECONDS
public static final long DEFAULT_REFRESH_INTERVAL_IN_SECONDS- See Also:
-
DEFAULT_CONN_WARMUP_TIMEOUT_IN_SECONDS_DEFAULT
public static final long DEFAULT_CONN_WARMUP_TIMEOUT_IN_SECONDS_DEFAULT- See Also:
-
-
Constructor Details
-
RequestBasedMetadata
-
-
Method Details
-
getClusterName
-
getCurrentStoreVersion
public int getCurrentStoreVersion() -
getPartitionId
-
getReplicas
-
start
public void start() -
whetherToSwitchToFetchedCurrentVersion
-
isPartitionResourcesReady
-
close
- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Overrides:
closein classAbstractStoreMetadata- Throws:
IOException
-
getCompressor
-
getCompressionStrategy
Description copied from interface:StoreMetadataReturns theCompressionStrategyconfigured for the given storeversion.The strategy is delivered to this metadata instance via the per-version
versionPropertieson each metadata-refresh response. The Fast Client'sdecompressAndDeserializeseam uses this internally to resolve the per-version compressor when decoding out-of-band value bytes.External integration layers should not call this directly — use
AvroGenericStoreClient.decompressAndDeserialize(java.nio.ByteBuffer, int, Object)instead, which handles the version → strategy → compressor → schema id resolution behind a single call.Unknown-version contract. The canonical
AbstractStoreMetadata-derived implementation throwsVeniceClientExceptionon a version it has never observed (e.g. caller typo, or a version evicted from the active set on a prior refresh). The default implementation here returnsCompressionStrategy.NO_OPso that lightweight test fakes do not need to track per-version state — fake-based tests should not pass unknown versions to begin with. -
getKeySchema
public org.apache.avro.Schema getKeySchema() -
getValueSchema
public org.apache.avro.Schema getValueSchema(int id) -
getValueSchemaId
public int getValueSchemaId(org.apache.avro.Schema schema) Description copied from interface:SchemaReaderReturn the schema ID of any schema that has the same parsing canonical form as the schema provided. If multiple schemas have the same parsing canonical form, return the one with the largest ID.- Parameters:
schema- The schema for which the schema ID is needed- Returns:
- The ID of the schema that has the same parsing canonical form as the schema provided
-
getLatestValueSchema
public org.apache.avro.Schema getLatestValueSchema() -
getLatestValueSchemaId
Description copied from interface:SchemaReaderGet the latest value schema id. This may be different from the value schema with the largest id if the superset schema is not the value schema with the largest id -
getUpdateSchema
public org.apache.avro.Schema getUpdateSchema(int valueSchemaId) -
getLatestUpdateSchema
-
isReady
public boolean isReady() -
getBatchGetLimit
public int getBatchGetLimit()- Specified by:
getBatchGetLimitin interfaceStoreMetadata- Overrides:
getBatchGetLimitin classAbstractStoreMetadata
-
setD2ServiceDiscovery
Used for test only- Parameters:
d2ServiceDiscovery-
-
setScheduler
-
getScheduler
-
setIsReadyLatch
-
getIsReadyLatch
-
setRefreshIntervalInSeconds
public void setRefreshIntervalInSeconds(long refreshIntervalInSeconds) -
getRefreshIntervalInSeconds
public long getRefreshIntervalInSeconds() -
getWarmUpInstancesFutures
-
setWarmUpInstancesFutures
-