Package com.linkedin.alpini.router.api
Interface PartitionFinder<K>
-
- All Known Implementing Classes:
VenicePartitionFinder
public interface PartitionFinder<K>
Provides methods to find the partition name for a piece of data.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description java.lang.String
findPartitionName(java.lang.String resourceName, K partitionKey)
Returns the name of partition for the given key within the given table.int
findPartitionNumber(K 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
-
-
-
Method Detail
-
findPartitionName
@Nonnull java.lang.String findPartitionName(@Nonnull java.lang.String resourceName, @Nonnull K partitionKey) throws RouterException
Returns the name of partition for the given key within the given table.- Parameters:
resourceName
- name of the databasepartitionKey
- partition key field for the data- Returns:
- name of the partition
- Throws:
RouterException
- if there was an error
-
getAllPartitionNames
@Nonnull java.util.List<java.lang.String> getAllPartitionNames(@Nonnull java.lang.String resourceName) throws RouterException
- Throws:
RouterException
-
getNumPartitions
int getNumPartitions(@Nonnull java.lang.String resourceName) throws RouterException
Returns the number of partitions for a given db- Parameters:
resourceName
- name of the database- Throws:
RouterException
-
findPartitionNumber
int findPartitionNumber(@Nonnull K partitionKey, int numPartitions, java.lang.String storeName, int versionNumber) throws RouterException
Venice-specific API for finding the partition number without the added overhead of parsing a partition name.- Throws:
RouterException
-
-