def __init__(self,
                 partition_key_extractor,
                 collection_links,
                 default_number_of_virtual_nodes_per_collection=128,
                 hash_generator=None):
        """
        :Parameters:
            - `partition_key_extractor`: lambda, returning the partition key from the document passed.
            - `collection_links`: list, the links of collections participating in partitioning.
            - `default_number_of_virtual_nodes_per_collection`: int, number of virtual nodes per collection.
            - `hash_generator`: HashGenerator, the hash generator to be used for hashing algorithm.
        """
        if partition_key_extractor is None:
            raise ValueError("partition_key_extractor is None.")
        if collection_links is None:
            raise ValueError("collection_links is None.")
        if default_number_of_virtual_nodes_per_collection <= 0:
            raise ValueError(
                "The number of virtual nodes per collection must greater than 0."
            )

        self.partition_key_extractor = partition_key_extractor
        self.collection_links = collection_links

        if hash_generator is None:
            hash_generator = murmur_hash._MurmurHash()

        self.consistent_hash_ring = consistent_hash_ring._ConsistentHashRing(
            self.collection_links,
            default_number_of_virtual_nodes_per_collection, hash_generator)
    def __init__(self, partition_key_extractor, collection_links, default_number_of_virtual_nodes_per_collection = 128, hash_generator = None):
        """
        :Parameters:
            - `partition_key_extractor`: lambda, returning the partition key from the document passed.
            - `collection_links`: list, the links of collections participating in partitioning.
            - `default_number_of_virtual_nodes_per_collection`: int, number of virtual nodes per collection.
            - `hash_generator`: HashGenerator, the hash generator to be used for hashing algorithm.
        """
        if partition_key_extractor is None:
            raise ValueError("partition_key_extractor is None.")
        if collection_links is None:
            raise ValueError("collection_links is None.")
        if default_number_of_virtual_nodes_per_collection <= 0:
            raise ValueError("The number of virtual nodes per collection must greater than 0.")
        
        self.partition_key_extractor = partition_key_extractor
        self.collection_links = collection_links

        if hash_generator is None:
            hash_generator = murmur_hash._MurmurHash()

        self.consistent_hash_ring = consistent_hash_ring._ConsistentHashRing(self.collection_links, default_number_of_virtual_nodes_per_collection, hash_generator)