Interface StoreMetadata

All Superinterfaces:
AutoCloseable, Closeable, SchemaReader
All Known Implementing Classes:
AbstractStoreMetadata, RequestBasedMetadata

public interface StoreMetadata extends SchemaReader
This interface defines the APIs to retrieve store metadata and routing data, and it also includes the feedback APIs: trackHealthBasedOnRequestToInstance(java.lang.String, int, int, java.util.concurrent.CompletableFuture<com.linkedin.venice.client.store.transport.TransportClientResponse>) to decide the healthiness of each replica.
  • Method Details

    • getClusterName

      String getClusterName()
    • getStoreName

      String getStoreName()
    • getCurrentStoreVersion

      int getCurrentStoreVersion()
    • getPartitionId

      int getPartitionId(int version, ByteBuffer key)
    • getPartitionId

      int getPartitionId(int version, byte[] key)
    • getReplicas

      List<String> getReplicas(int version, int partitionId)
    • getReplica

      String 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".
    • trackHealthBasedOnRequestToInstance

      ChainedCompletableFuture<Integer,Integer> trackHealthBasedOnRequestToInstance(String instance, int version, int partitionId, CompletableFuture<TransportClientResponse> transportFuture)
    • getInstanceHealthMonitor

      InstanceHealthMonitor getInstanceHealthMonitor()
    • getCompressor

      VeniceCompressor getCompressor(CompressionStrategy compressionStrategy, int version)
    • getCompressionStrategy

      default CompressionStrategy getCompressionStrategy(int version)
      Returns the CompressionStrategy configured for the given store version.

      The strategy is delivered to this metadata instance via the per-version versionProperties on each metadata-refresh response. The Fast Client's decompressAndDeserialize seam 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 throws VeniceClientException on 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 returns CompressionStrategy.NO_OP so that lightweight test fakes do not need to track per-version state — fake-based tests should not pass unknown versions to begin with.

    • getBatchGetLimit

      int getBatchGetLimit()
    • start

      void start()
    • isReady

      default boolean isReady()
    • routeRequest

      <K> void routeRequest(RequestContext requestContext, RecordSerializer<K> keySerializer)
    • registerVersionSwitchListener

      default void registerVersionSwitchListener(StoreVersionSwitchListener listener)
      Register 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. See StoreVersionSwitchListener for threading and exception semantics.

      Registration timing. Listeners must be registered before start() to observe the initial transition committed by the first refresh. Listeners registered after start() returns observe only subsequent transitions.

      listener must not be null. Default implementations of StoreMetadata (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 canonical AbstractStoreMetadata implementation.

      Throws:
      IllegalArgumentException - if listener is null
    • registerStoreConfigChangeListener

      default void registerStoreConfigChangeListener(StoreConfigChangeListener listener)
      Register a callback that fires when the metadata refresh loop observes a change to the store-level config snapshot (e.g. operator-driven ExternalStorageReadMode flip). The callback is invoked after the new snapshot has been committed to the local cache. See StoreConfigChangeListener for threading and exception semantics.

      Registration timing. Same as registerVersionSwitchListener(com.linkedin.venice.client.store.listeners.StoreVersionSwitchListener) — register before start() to observe the initial snapshot; post-start registration observes only subsequent changes.

      listener must not be null. Default implementations of StoreMetadata (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 canonical AbstractStoreMetadata implementation.

      Throws:
      IllegalArgumentException - if listener is null