你当前正在访问 Microsoft Azure Global Edition 技术文档网站。 如果需要访问由世纪互联运营的 Microsoft Azure 中国技术文档网站,请访问 https://docs.azure.cn

HashPartitionResolver 类

定义

注意

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

HashPartitionResolver 基于哈希函数的值实现分区,使你能够跨 Azure Cosmos DB 服务中的多个分区均匀分配请求和数据。

[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 HashPartitionResolver : IDisposable, Microsoft.Azure.Documents.Client.IPartitionResolver
[<System.Obsolete("Support for IPartitionResolver based classes is now obsolete. It's recommended that you use partitioned collections for higher storage and throughput.")>]
type HashPartitionResolver = class
    interface IPartitionResolver
    interface IDisposable
Public Class HashPartitionResolver
Implements IDisposable, IPartitionResolver
继承
HashPartitionResolver
属性
实现

注解

对基于 IPartitionResolver 的类的支持现已过时。 建议使用 分区集合 提高存储和吞吐量。

HashPartitionResolver 类在内部通过接口中指定的 IHashGenerator 哈希函数实现一致的哈希环。 默认情况下,HashPartitionResolver 提供 MD5 哈希函数,但这可以替换为不同的哈希实现。 一致的哈希环为每个集合创建 16 个副本,以实现文档在集合中的更统一分布。

当分区键具有较高的基数时,哈希分区最适合分区,因为它会在集合之间均匀分布数据。 通常,哈希分区使用 id 属性。 哈希分区的常见用例是从大量不同的客户端生成或使用的数据,或者用于存储用户配置文件、目录项和遥测数据。

构造函数

HashPartitionResolver(Func<Object,String>, IEnumerable<String>, Int32, IHashGenerator)
已过时.

使用指定的partitionKeyExtractor值在 Azure Cosmos DB 服务中初始化 的新实例HashPartitionResolver

HashPartitionResolver(String, IEnumerable<String>, Int32, IHashGenerator)
已过时.

使用指定的partitionKeyPropertyName值在 Azure Cosmos DB 服务中初始化 的新实例HashPartitionResolver

属性

CollectionLinks
已过时.

获取 Azure Cosmos DB 服务中用于哈希的集合链接的 IEnumerable。

HashGenerator
已过时.

获取在一致哈希中使用的 HashGenerator。

NumberOfVirtualNodesPerCollection
已过时.

Azure Cosmos DB 服务中连续哈希环中每个集合的虚拟节点数。 这可以控制跨集合的文档偏斜性与一致的哈希延迟。

PartitionKeyExtractor
已过时.

获取用于从 Azure Cosmos DB 服务中的对象中提取分区键的函数。

PartitionKeyPropertyName
已过时.

获取文档中要对 Azure Cosmos DB 服务执行哈希处理的属性的名称。

方法

Dispose()
已过时.

释放 Azure Cosmos DB 服务中的解析程序。

GetPartitionKey(Object)
已过时.

使用 Azure Cosmos DB 服务中按首选项顺序的指定属性或PartitionKeyExtractor函数从指定PartitionKeyPropertyName文档中提取分区键。

ResolveForCreate(Object)
已过时.

给定分区键后,返回用于在 Azure Cosmos DB 服务中创建文档的集合自链接。

ResolveForRead(Object)
已过时.

给定分区键后,返回一个集合链接列表,以使用 Azure Cosmos DB 服务中的哈希从中读取。

适用于