docs: sanitize
[awesomized/libmemcached] / docs / source / hashkit_function.rst
1 Set Hash Function
2 =================
3
4 .. index:: object: hashkit_st
5 .. index:: object: hashkit_hash_fn
6
7 Set hash functions to use for calculating values for keys
8
9 SYNOPSIS
10 --------
11
12 #include <libhashkit-|libhashkit_version|/hashkit.h>
13 Compile and link with -lhashkit
14
15 .. c:type:: hashkit_hash_fn
16
17 .. code-block:: c
18
19 typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length, void *context);
20
21 .. c:function:: hashkit_return_t hashkit_set_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm)
22
23 .. c:function:: hashkit_return_t hashkit_set_custom_function(hashkit_st *hash, hashkit_hash_fn function, void *context)
24
25 .. c:function:: hashkit_hash_algorithm_t hashkit_get_function(const hashkit_st *hash)
26
27 .. c:function:: hashkit_return_t hashkit_set_distribution_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm)
28
29 .. c:function:: hashkit_return_t hashkit_set_custom_distribution_function(hashkit_st *self, hashkit_hash_fn function, void *context)
30
31 .. c:function:: hashkit_hash_algorithm_t hashkit_get_distribution_function(const hashkit_st *self)
32
33 DESCRIPTION
34 -----------
35
36 These functions are used to set and retrieve the key and distribution hash functions.
37
38
39 RETURN VALUE
40 ------------
41
42 :c:func:`hashkit_set_function`, :c:func:`hashkit_set_custom_function` and the distribution equivalents
43 return :c:type:`hashkit_return_t` `HASHKIT_SUCCESS` on success.
44
45 :c:func:`hashkit_get_function` and :c:func:`hashkit_get_distribution_function` return :c:type:`hashkit_hash_algorithm_t`
46 indicating the hash function used.
47
48 SEE ALSO
49 --------
50
51 .. only:: man
52
53 :manpage:`libhashkit(3)`
54 :manpage:`hashkit_create(3)`
55 :manpage:`hashkit_functions(3)`
56
57 .. only:: html
58
59 * :doc:`libhashkit`
60 * :doc:`hashkit_create`
61 * :doc:`hashkit_functions`
62