Condividi tramite


RangePartitionResolver<T> Class

Definition

Caution

Support for IPartitionResolver based classes is now obsolete. It's recommended that you use partitioned collections for higher storage and throughput.

RangePartitionResolver implements partitioning in Azure Cosmos DB service by using a partition map of ranges of values to a collection self-link. This works well when the data is naturally ordered and commonly queried upon using ranges of values, e.g., for time series data or alphabetical ranges of strings.

[System.Obsolete("Support for IPartitionResolver based classes is now obsolete. It's recommended that you use partitioned collections for higher storage and throughput.")]
public class RangePartitionResolver<T> : Microsoft.Azure.Documents.Client.IPartitionResolver where T : IComparable<T>, IEquatable<T>
[<System.Obsolete("Support for IPartitionResolver based classes is now obsolete. It's recommended that you use partitioned collections for higher storage and throughput.")>]
type RangePartitionResolver<'T (requires 'T :> IComparable<'T> and 'T :> IEquatable<'T>)> = class
    interface IPartitionResolver
Public Class RangePartitionResolver(Of T)
Implements IPartitionResolver

Type Parameters

T

The type of value to use for range partitioning.

Inheritance
RangePartitionResolver<T>
Attributes
Implements

Remarks

Support for IPartitionResolver based classes is now obsolete. It's recommended that you use Partitioned Collections for higher storage and throughput.

In range partitioning, partitions are assigned based on whether the partition key is within a certain range. The RangePartitionResolver class helps you maintain a mapping between a Range<T> and collection self-link.

Range<T> is a simple class for specifying ranges of any types that implement IComparable<T> and IEquatable<T> like strings or numbers. For reads and creates, you can pass in any arbitrary range, and the resolver identifies all the candidate collections by identifying the ranges of the partitions that intersect twith the requested range.

A special case of range partitioning is when the range is just a single discrete value, sometimes called Lookup Partitioning. This is commonly used for partitioning by discrete values like Region or Type or for partitioning tenants in a multi-tenant application.

Constructors

RangePartitionResolver<T>(Func<Object,Object>, IDictionary<Range<T>,String>)

Initializes a new instance of the HashPartitionResolver in the Azure Cosmos DB service using the specified partitionKeyExtractor value.

RangePartitionResolver<T>(String, IDictionary<Range<T>,String>)

Initializes a new instance of the RangePartitionResolver<T> class in the Azure Cosmos DB service using the specified partitionKeyPropertyName value.

Properties

PartitionKeyExtractor

Gets the function to extract the partition key from any object in the Azure Cosmos DB service.

PartitionKeyPropertyName

The name of the property in the document to execute the hashing on in the Azure Cosmos DB service.

PartitionMap

Gets the map from range to collection-link that is used for partitioning requests in the Azure Cosmos DB service.

Methods

GetPartitionKey(Object)

Extracts the partition key from the specified document using the specified PartitionKeyPropertyName property or PartitionKeyExtractor function in order of preference in the Azure Cosmos DB service.

ResolveForCreate(Object)

Given a partition key, returns the correct collection self-link for creating a document using the range partition map in the Azure Cosmos DB service.

ResolveForRead(Object)

Given a partition key, returns a list of collection links to read from using the range partition map in the Azure Cosmos DB service.

Applies to