Function scylla::transport::partitioner::calculate_token_for_partition_key
source ยท pub fn calculate_token_for_partition_key<P: Partitioner>(
serialized_partition_key_values: &SerializedValues,
partitioner: &P,
) -> Result<Token, TokenCalculationError>
Expand description
Calculates the token for given partitioner and serialized partition key.
The ordinary way to calculate token is based on a PreparedStatement and values for that statement. However, if a user knows:
- the order of the columns in the partition key,
- the values of the columns of the partition key,
- the partitioner of the table that the statement operates on,
then having a PreparedStatement
is not necessary and the token can
be calculated based on that information.
NOTE: the provided values must completely constitute partition key and be in the order defined in CREATE TABLE statement.