.\" Man page generated from reStructuredText. . . .nr rst2man-indent-level 0 . .de1 rstReportMargin \\$1 \\n[an-margin] level \\n[rst2man-indent-level] level margin: \\n[rst2man-indent\\n[rst2man-indent-level]] - \\n[rst2man-indent0] \\n[rst2man-indent1] \\n[rst2man-indent2] .. .de1 INDENT .\" .rstReportMargin pre: . RS \\$1 . nr rst2man-indent\\n[rst2man-indent-level] \\n[an-margin] . nr rst2man-indent-level +1 .\" .rstReportMargin post: .. .de UNINDENT . RE .\" indent \\n[an-margin] .\" old: \\n[rst2man-indent\\n[rst2man-indent-level]] .nr rst2man-indent-level -1 .\" new: \\n[rst2man-indent\\n[rst2man-indent-level]] .in \\n[rst2man-indent\\n[rst2man-indent-level]]u .. .TH "HASHKIT_GET_FUNCTION" "3" "Feb 01, 2024" "1.1" "libmemcached-awesome" .SH NAME hashkit_get_function \- libhashkit Documentation .SH SYNOPSIS .INDENT 0.0 .TP .B #include Compile and link with \-lhashkit .UNINDENT .INDENT 0.0 .TP .B typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length, void *context) .INDENT 7.0 .TP .B Param key the key to generate a hash of .TP .B Param key_length the length of the \fBkey\fP without any terminating zero byte .TP .B Param context the custom hash function context set through \fI\%hashkit_set_custom_function()\fP or \fI\%hashkit_set_custom_distribution_function()\fP .TP .B Returns the custom hash function should return a hash value for \fBkey\fP as an unsigned 32bit integer .UNINDENT .UNINDENT .INDENT 0.0 .TP .B typedef enum \fI\%hashkit_return_t\fP hashkit_return_t .UNINDENT .INDENT 0.0 .TP .B enum hashkit_return_t .INDENT 7.0 .TP .B enumerator HASHKIT_SUCCESS Operation succeeded. .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_FAILURE Operation failed. .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_MEMORY_ALLOCATION_FAILURE Memory allocation failed. .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_INVALID_HASH Invalid \fI\%hashkit_hash_algorithm_t\fP passed. .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_INVALID_ARGUMENT Invalid argument passed. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B typedef enum \fI\%hashkit_hash_algorithm_t\fP hashkit_hash_algorithm_t .UNINDENT .INDENT 0.0 .TP .B enum hashkit_hash_algorithm_t .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_DEFAULT Default hash algorithm (one_at_a_time). .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_MD5 .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_CRC .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_FNV1_64 .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_FNV1A_64 .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_FNV1_32 .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_FNV1A_32 .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_HSIEH Only available if \fBlibhashkit\fP hash been built with HSIEH support. .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_MURMUR Only available if \fBlibhashkit\fP has been built with MURMUR support. .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_MURMUR3 Only available if \fBlibhashkit\fP has been built with MURMUR support. .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_JENKINS .UNINDENT .INDENT 7.0 .TP .B enumerator HASHKIT_HASH_CUSTOM Use custom \fI\%hashkit_hash_fn\fP function set through \fI\%hashkit_set_custom_function()\fP or \fI\%hashkit_set_custom_distribution_function()\fP\&. .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%hashkit_return_t\fP hashkit_set_function(\fI\%hashkit_st\fP *hash, \fI\%hashkit_hash_algorithm_t\fP hash_algorithm) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBhash\fP \-\- pointer to an initialized \fI\%hashkit_st\fP struct .IP \(bu 2 \fBhash_algorithm\fP \-\- valid \fI\%hashkit_hash_algorithm_t\fP constant .UNINDENT .TP .B Returns \fI\%hashkit_return_t\fP indicating success or failure .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%hashkit_return_t\fP hashkit_set_custom_function(\fI\%hashkit_st\fP *hash, \fI\%hashkit_hash_fn\fP function, void *context) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBhash\fP \-\- pointer to initialized \fI\%hashkit_st\fP struct .IP \(bu 2 \fBfunction\fP \-\- \fI\%hashkit_hash_fn\fP function pointer to use as hash function for \fI\%HASHKIT_HASH_CUSTOM\fP .IP \(bu 2 \fBcontext\fP \-\- pointer to an opaque user managed context for the custom hash function .UNINDENT .TP .B Returns \fI\%hashkit_return_t\fP indicating success or failure .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%hashkit_hash_algorithm_t\fP hashkit_get_function(const \fI\%hashkit_st\fP *hash) .INDENT 7.0 .TP .B Parameters \fBhash\fP \-\- pointer to an initialized \fI\%hashkit_st\fP struct .TP .B Returns \fI\%hashkit_hash_algorithm_t\fP indicating the currently set hash algorithm to use .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%hashkit_return_t\fP hashkit_set_distribution_function(\fI\%hashkit_st\fP *hash, \fI\%hashkit_hash_algorithm_t\fP hash_algorithm) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBhash\fP \-\- pointer to an initialized \fI\%hashkit_st\fP struct .IP \(bu 2 \fBhash_algorithm\fP \-\- valid \fBhashkit_hash_algrothm_t\fP constant .UNINDENT .TP .B Returns \fI\%hashkit_return_t\fP indicating success or failure .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%hashkit_return_t\fP hashkit_set_custom_distribution_function(\fI\%hashkit_st\fP *hash, \fI\%hashkit_hash_fn\fP function, void *context) .INDENT 7.0 .TP .B Parameters .INDENT 7.0 .IP \(bu 2 \fBhash\fP \-\- pointer to initialized \fI\%hashkit_st\fP struct .IP \(bu 2 \fBfunction\fP \-\- \fI\%hashkit_hash_fn\fP function pointer to use as distribution hash function for \fI\%HASHKIT_HASH_CUSTOM\fP .IP \(bu 2 \fBcontext\fP \-\- pointer to an opaque user managed context for the custom distribution hash function .UNINDENT .UNINDENT .UNINDENT .INDENT 0.0 .TP .B \fI\%hashkit_hash_algorithm_t\fP hashkit_get_distribution_function(const \fI\%hashkit_st\fP *hash) .INDENT 7.0 .TP .B Parameters \fBhash\fP \-\- pointer to an initialized \fI\%hashkit_st\fP struct .TP .B Returns \fI\%hashkit_hash_algorithm_t\fP indicating the currently set distribution hash algorithm to use .UNINDENT .UNINDENT .SH DESCRIPTION .sp These functions are used to set and retrieve the key and distribution hash functions. .SH RETURN VALUE .sp \fI\%hashkit_set_function()\fP, \fI\%hashkit_set_custom_function()\fP and the distribution equivalents return \fI\%hashkit_return_t::HASHKIT_SUCCESS\fP on success. .sp \fI\%hashkit_get_function()\fP and \fI\%hashkit_get_distribution_function()\fP return \fI\%hashkit_hash_algorithm_t\fP indicating the hash function used. .SH SEE ALSO .sp \fBlibhashkit(3)\fP \fBhashkit_create(3)\fP \fBhashkit_functions(3)\fP .\" Generated by docutils manpage writer. .