HashPartitionResolver Class

HashPartitionResolver implements partitioning based on the value of a hash function, allowing you to evenly distribute requests and data across a number of partitions.

Inheritance
builtins.object
HashPartitionResolver

Constructor

HashPartitionResolver(partition_key_extractor, collection_links, default_number_of_virtual_nodes_per_collection=128, hash_generator=None)

Parameters

partition_key_extractor
collection_links
default_number_of_virtual_nodes_per_collection
default value: 128
hash_generator
default value: None

Methods

ResolveForCreate

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

ResolveForRead

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

ResolveForCreate

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

ResolveForCreate(document)

Parameters

document
dict
Required

The document to be created.

Returns

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

Return type

str

ResolveForRead

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

ResolveForRead(partition_key)

Parameters

document
dict
Required

The document to be read/queried.

Returns

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

Return type