RangePartitionResolver<T> Class

  • java.lang.Object

Type Parameters

T

public class RangePartitionResolver<T extends Comparable> implements PartitionResolver

RangePartitionResolver implements partitioning based on the ranges in the Azure Cosmos DB database service. It allows you to distribute requests and data across a number of partitions by implementing PartitionResolver interface.

Constructor Summary

Constructor Description
RangePartitionResolver(PartitionKeyExtractor partitionKeyExtractor, Map<Range<T>, String> partitionMap)

RangePartitionResolver constructor taking in the PartitionKeyExtractor, a map of Ranges to collection links.

Method Summary

Modifier and Type Method and Description
String resolveForCreate(Object document)

Resolves the collection for creating the document based on the partition key.

Iterable<String> resolveForRead(Object partitionKey)

Resolves the collection for reading/querying the documents based on the partition key.

Constructor Details

RangePartitionResolver

public RangePartitionResolver(PartitionKeyExtractor partitionKeyExtractor, Map, String> partitionMap)

RangePartitionResolver constructor taking in the PartitionKeyExtractor, a map of Ranges to collection links.

Parameters:

partitionKeyExtractor - an instance of class that implements PartitionKeyExtractor interface.
partitionMap - the map of ranges to collection links.

Method Details

resolveForCreate

public String resolveForCreate(Object document)

Resolves the collection for creating the document based on the partition key.

Overrides:

RangePartitionResolver<T>.resolveForCreate(Object document)

Parameters:

document - the document to be created.

Returns:

collection Self link or Name based link which should handle the Create operation.

resolveForRead

public Iterable resolveForRead(Object partitionKey)

Resolves the collection for reading/querying the documents based on the partition key.

Overrides:

RangePartitionResolver<T>.resolveForRead(Object partitionKey)

Parameters:

partitionKey - the partition key value.

Returns:

collection Self link(s) or Name based link(s) which should handle the Read operation.

Applies to