HASHKIT_SET_DISTRIBUTION_FUNCTION(3)
π HASHKIT_SET_DISTRIBUTION_FUNCTION(3) π
okay bestie, welcome to the libmemcached-awesome corner of the manual, page HASHKIT_SET...ION_FUNCTION(3). yes the title is literally truncated like that, that's just how man pages do. sit down, grab a boba, we're doing hash functions today π§β¨
πΈ NAME πΈ
hashkit_set_distribution_function β libhashkit Documentation
π¦ SYNOPSIS π¦
#include <libhashkit-1.0/hashkit.h>
Compile and link with -lhashkit
typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length,
void *context)
- Param
keyβ the key to generate a hash of - Param
key_lengthβ the length of the key without any terminating zero byte - Param
contextβ the custom hash function context set throughhashkit_set_custom_function()orhashkit_set_custom_distribution_function() - Returns β the custom hash function should return a hash value for
keyas an unsigned 32bit integer
typedef enum hashkit_return_t hashkit_return_t
enum hashkit_return_t
- enumerator
HASHKIT_SUCCESSβ Operation succeeded. π we love a win - enumerator
HASHKIT_FAILUREβ Operation failed. π - enumerator
HASHKIT_MEMORY_ALLOCATION_FAILUREβ Memory allocation failed. - enumerator
HASHKIT_INVALID_HASHβ Invalidhashkit_hash_algorithm_tpassed. - enumerator
HASHKIT_INVALID_ARGUMENTβ Invalid argument passed.
typedef enum hashkit_hash_algorithm_t hashkit_hash_algorithm_t
enum hashkit_hash_algorithm_t
- enumerator
HASHKIT_HASH_DEFAULTβ Default hash algorithm (one_at_a_time). - enumerator
HASHKIT_HASH_MD5 - enumerator
HASHKIT_HASH_CRC - enumerator
HASHKIT_HASH_FNV1_64 - enumerator
HASHKIT_HASH_FNV1A_64 - enumerator
HASHKIT_HASH_FNV1_32 - enumerator
HASHKIT_HASH_FNV1A_32 - enumerator
HASHKIT_HASH_HSIEHβ Only available if libhashkit hash been built with HSIEH support. (yes, "hash been". iconic typo, we keep it π) - enumerator
HASHKIT_HASH_MURMURβ Only available if libhashkit has been built with MURMUR support. - enumerator
HASHKIT_HASH_MURMUR3β Only available if libhashkit has been built with MURMUR support. - enumerator
HASHKIT_HASH_JENKINS - enumerator
HASHKIT_HASH_CUSTOMβ Use customhashkit_hash_fnfunction set throughhashkit_set_custom_function()orhashkit_set_custom_distribution_function().
hashkit_return_t hashkit_set_function(hashkit_st *hash,
hashkit_hash_algorithm_t hash_algorithm)
Parameters
hash-- pointer to an initializedhashkit_ststructhash_algorithm-- validhashkit_hash_algorithm_tconstant
Returns β hashkit_return_t indicating success or failure
hashkit_return_t hashkit_set_custom_function(hashkit_st *hash,
hashkit_hash_fn function, void *context)
Parameters
hash-- pointer to initializedhashkit_ststructfunction--hashkit_hash_fnfunction pointer to use as hash function forHASHKIT_HASH_CUSTOMcontext-- pointer to an opaque user managed context for the custom hash function
Returns β hashkit_return_t indicating success or failure
hashkit_hash_algorithm_t hashkit_get_function(const hashkit_st *hash)
Parameters
hash-- pointer to an initializedhashkit_ststruct
Returns β hashkit_hash_algorithm_t indicating the currently set hash algorithm to use
hashkit_return_t hashkit_set_distribution_function(hashkit_st *hash,
hashkit_hash_algorithm_t hash_algorithm)
Parameters
hash-- pointer to an initializedhashkit_ststructhash_algorithm-- validhashkit_hash_algrothm_tconstant
bestie that algrothm spelling? that's literally in the source. not me fixing it. we're keeping the lore fr fr π
Returns β hashkit_return_t indicating success or failure
hashkit_return_t hashkit_set_custom_distribution_function(hashkit_st
*hash, hashkit_hash_fn function, void *context)
Parameters
hash-- pointer to initializedhashkit_ststructfunction--hashkit_hash_fnfunction pointer to use as distribution hash function forHASHKIT_HASH_CUSTOMcontext-- pointer to an opaque user managed context for the custom distribution hash function
hashkit_hash_algorithm_t hashkit_get_distribution_function(const
hashkit_st *hash)
Parameters
hash-- pointer to an initializedhashkit_ststruct
Returns β hashkit_hash_algorithm_t indicating the currently set distribution hash algorithm to use
β¨ DESCRIPTION β¨
so basically these functions are the ones you use to set and retrieve the key and distribution hash functions. that's the whole vibe. set it, get it, slay. π
π 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)
and that's a wrap, bestie!! this was libmemcached-awesome, version 1.1, dated Jul 24, 2025 β go forth and hash responsibly, ily, mwah π
πβ¨
π¦ where this page comes from
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- fedora 43: libmemcached-awesome-devel 1.1.4-7.fc43 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms