Scroll to navigation

HASHKIT_SET_FUNCTION(3) libmemcached-awesome HASHKIT_SET_FUNCTION(3)

NAME

hashkit_set_function - libhashkit Documentation

SYNOPSIS

#include <libhashkit-1.0/hashkit.h>
Compile and link with -lhashkit

  • key -- the key to generate a hash of
  • key_length -- the length of the key without any terminating zero byte
  • context -- the custom hash function context set through hashkit_set_custom_function() or hashkit_set_custom_distribution_function()

the custom hash function should return a hash value for key as an unsigned 32bit integer



Operation succeeded.

Operation failed.


Invalid hashkit_hash_algorithm_t passed.

Invalid argument passed.



Default hash algorithm (one_at_a_time).







Only available if libhashkit hash been built with HSIEH support.

Only available if libhashkit has been built with MURMUR support.

Only available if libhashkit has been built with MURMUR support.


Use custom hashkit_hash_fn function set through hashkit_set_custom_function() or hashkit_set_custom_distribution_function().


  • hash -- pointer to an initialized hashkit_st struct
  • hash_algorithm -- valid hashkit_hash_algorithm_t constant

hashkit_return_t indicating success or failure


  • hash -- pointer to initialized hashkit_st struct
  • function -- hashkit_hash_fn function pointer to use as hash function for HASHKIT_HASH_CUSTOM
  • context -- pointer to an opaque user managed context for the custom hash function

hashkit_return_t indicating success or failure


hash -- pointer to an initialized hashkit_st struct
hashkit_hash_algorithm_t indicating the currently set hash algorithm to use


  • hash -- pointer to an initialized hashkit_st struct
  • hash_algorithm -- valid hashkit_hash_algrothm_t constant

hashkit_return_t indicating success or failure


  • hash -- pointer to initialized hashkit_st struct
  • function -- hashkit_hash_fn function pointer to use as distribution hash function for HASHKIT_HASH_CUSTOM
  • context -- pointer to an opaque user managed context for the custom distribution hash function



hash -- pointer to an initialized hashkit_st struct
hashkit_hash_algorithm_t indicating the currently set distribution hash algorithm to use


DESCRIPTION

These functions are used to set and retrieve the key and distribution hash functions.

RETURN VALUE

hashkit_set_function(), hashkit_set_custom_function() and the distribution equivalents return hashkit_return_t::HASHKIT_SUCCESS on success.

hashkit_get_function() and hashkit_get_distribution_function() return hashkit_hash_algorithm_t indicating the hash function used.

SEE ALSO

libhashkit(3) hashkit_create(3) hashkit_functions(3)

November 12, 2021 1.1