Package com.linkedin.venice.router.api
Class VenicePartitionFinder
- java.lang.Object
-
- com.linkedin.venice.router.api.VenicePartitionFinder
-
- All Implemented Interfaces:
PartitionFinder<RouterKey>
public class VenicePartitionFinder extends java.lang.Object implements PartitionFinder<RouterKey>
VenicePartitionFinder
provides methods to find the partition name or number for the given data.
-
-
Constructor Summary
Constructors Constructor Description VenicePartitionFinder(RoutingDataRepository dataRepository, ReadOnlyStoreRepository metadataRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description VenicePartitioner
findPartitioner(java.lang.String storeName, int versionNum)
Query the map to find the partitioner in need.java.lang.String
findPartitionName(java.lang.String resourceName, RouterKey partitionKey)
Returns the name of partition for the given key within the given table.int
findPartitionNumber(RouterKey partitionKey, int numPartitions, java.lang.String storeName, int versionNumber)
Venice-specific API for finding the partition number without the added overhead of parsing a partition name.java.util.List<java.lang.String>
getAllPartitionNames(java.lang.String resourceName)
int
getNumPartitions(java.lang.String resourceName)
Returns the number of partitions for a given db
-
-
-
Constructor Detail
-
VenicePartitionFinder
public VenicePartitionFinder(RoutingDataRepository dataRepository, ReadOnlyStoreRepository metadataRepository)
-
-
Method Detail
-
findPartitionName
public java.lang.String findPartitionName(java.lang.String resourceName, RouterKey partitionKey)
Description copied from interface:PartitionFinder
Returns the name of partition for the given key within the given table.- Specified by:
findPartitionName
in interfacePartitionFinder<RouterKey>
- Parameters:
resourceName
-partitionKey
-- Returns:
- partition Name, ex "store_v3_5"
-
findPartitionNumber
public int findPartitionNumber(RouterKey partitionKey, int numPartitions, java.lang.String storeName, int versionNumber)
Description copied from interface:PartitionFinder
Venice-specific API for finding the partition number without the added overhead of parsing a partition name.- Specified by:
findPartitionNumber
in interfacePartitionFinder<RouterKey>
-
getAllPartitionNames
public java.util.List<java.lang.String> getAllPartitionNames(java.lang.String resourceName)
- Specified by:
getAllPartitionNames
in interfacePartitionFinder<RouterKey>
-
getNumPartitions
public int getNumPartitions(java.lang.String resourceName)
Description copied from interface:PartitionFinder
Returns the number of partitions for a given db- Specified by:
getNumPartitions
in interfacePartitionFinder<RouterKey>
- Parameters:
resourceName
- name of the database
-
findPartitioner
public VenicePartitioner findPartitioner(java.lang.String storeName, int versionNum)
Query the map to find the partitioner in need. If miss, real search using store info happens insearchPartitioner(java.lang.String, int)
-
-