Class RequestBasedMetadata
- java.lang.Object
-
- com.linkedin.venice.fastclient.meta.AbstractStoreMetadata
-
- com.linkedin.venice.fastclient.meta.RequestBasedMetadata
-
- All Implemented Interfaces:
StoreMetadata
,SchemaReader
,java.io.Closeable
,java.lang.AutoCloseable
public class RequestBasedMetadata extends AbstractStoreMetadata
Store metadata class that uses the server's endpoint to fetch metadata and keep the local cache up to date.
-
-
Field Summary
Fields Modifier and Type Field Description static long
DEFAULT_CONN_WARMUP_TIMEOUT_IN_SECONDS_DEFAULT
static long
DEFAULT_REFRESH_INTERVAL_IN_SECONDS
-
Fields inherited from class com.linkedin.venice.fastclient.meta.AbstractStoreMetadata
routingStrategy, storeName
-
-
Constructor Summary
Constructors Constructor Description RequestBasedMetadata(ClientConfig clientConfig, D2TransportClient d2TransportClient)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
int
getBatchGetLimit()
java.lang.String
getClusterName()
VeniceCompressor
getCompressor(CompressionStrategy compressionStrategy, int version)
int
getCurrentStoreVersion()
java.util.concurrent.CountDownLatch
getIsReadyLatch()
org.apache.avro.Schema
getKeySchema()
DerivedSchemaEntry
getLatestUpdateSchema()
org.apache.avro.Schema
getLatestValueSchema()
java.lang.Integer
getLatestValueSchemaId()
Get the latest value schema id.int
getPartitionId(int version, java.nio.ByteBuffer key)
long
getRefreshIntervalInSeconds()
java.util.List<java.lang.String>
getReplicas(int version, int partitionId)
java.util.concurrent.ScheduledExecutorService
getScheduler()
org.apache.avro.Schema
getUpdateSchema(int valueSchemaId)
org.apache.avro.Schema
getValueSchema(int id)
int
getValueSchemaId(org.apache.avro.Schema schema)
Return the schema ID of any schema that has the same parsing canonical form as the schema provided.java.util.Map<java.lang.String,java.util.concurrent.CompletableFuture>
getWarmUpInstancesFutures()
boolean
isReady()
void
setD2ServiceDiscovery(D2ServiceDiscovery d2ServiceDiscovery)
Used for test onlyvoid
setIsReadyLatch(java.util.concurrent.CountDownLatch isReadyLatch)
void
setRefreshIntervalInSeconds(long refreshIntervalInSeconds)
void
setScheduler(java.util.concurrent.ScheduledExecutorService scheduler)
void
setWarmUpInstancesFutures(java.util.Map<java.lang.String,java.util.concurrent.CompletableFuture> warmUpInstancesFutures)
void
start()
-
Methods inherited from class com.linkedin.venice.fastclient.meta.AbstractStoreMetadata
getCompressor, getInstanceHealthMonitor, getPartitionId, getReplicas, getStoreName, setRoutingStrategy, setRoutingStrategy, trackHealthBasedOnRequestToInstance
-
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.fastclient.meta.StoreMetadata
getReplicas
-
-
-
-
Field Detail
-
DEFAULT_REFRESH_INTERVAL_IN_SECONDS
public static final long DEFAULT_REFRESH_INTERVAL_IN_SECONDS
- See Also:
- Constant Field Values
-
DEFAULT_CONN_WARMUP_TIMEOUT_IN_SECONDS_DEFAULT
public static final long DEFAULT_CONN_WARMUP_TIMEOUT_IN_SECONDS_DEFAULT
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
RequestBasedMetadata
public RequestBasedMetadata(ClientConfig clientConfig, D2TransportClient d2TransportClient)
-
-
Method Detail
-
getClusterName
public java.lang.String getClusterName()
-
getCurrentStoreVersion
public int getCurrentStoreVersion()
-
getPartitionId
public int getPartitionId(int version, java.nio.ByteBuffer key)
-
getReplicas
public java.util.List<java.lang.String> getReplicas(int version, int partitionId)
-
start
public void start()
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classAbstractStoreMetadata
- Throws:
java.io.IOException
-
getCompressor
public VeniceCompressor getCompressor(CompressionStrategy compressionStrategy, int version)
-
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:SchemaReader
Return the schema ID of any schema that has the same parsing canonical form as the schema provided.- 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
public java.lang.Integer getLatestValueSchemaId()
Description copied from interface:SchemaReader
Get 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
public DerivedSchemaEntry getLatestUpdateSchema()
-
isReady
public boolean isReady()
-
getBatchGetLimit
public int getBatchGetLimit()
- Specified by:
getBatchGetLimit
in interfaceStoreMetadata
- Overrides:
getBatchGetLimit
in classAbstractStoreMetadata
-
setD2ServiceDiscovery
public void setD2ServiceDiscovery(D2ServiceDiscovery d2ServiceDiscovery)
Used for test only- Parameters:
d2ServiceDiscovery
-
-
setScheduler
public void setScheduler(java.util.concurrent.ScheduledExecutorService scheduler)
-
getScheduler
public java.util.concurrent.ScheduledExecutorService getScheduler()
-
setIsReadyLatch
public void setIsReadyLatch(java.util.concurrent.CountDownLatch isReadyLatch)
-
getIsReadyLatch
public java.util.concurrent.CountDownLatch getIsReadyLatch()
-
setRefreshIntervalInSeconds
public void setRefreshIntervalInSeconds(long refreshIntervalInSeconds)
-
getRefreshIntervalInSeconds
public long getRefreshIntervalInSeconds()
-
getWarmUpInstancesFutures
public java.util.Map<java.lang.String,java.util.concurrent.CompletableFuture> getWarmUpInstancesFutures()
-
setWarmUpInstancesFutures
public void setWarmUpInstancesFutures(java.util.Map<java.lang.String,java.util.concurrent.CompletableFuture> warmUpInstancesFutures)
-
-