Updating tree for new function work in libhashkit.
[m6w6/libmemcached] / libhashkit / function.h
1 /* HashKit
2 * Copyright (C) 2010 Brian Aker
3 * All rights reserved.
4 *
5 * Use and distribution licensed under the BSD license. See
6 * the COPYING file in the parent directory for full text.
7 */
8
9 #ifndef HASHKIT_FUNCTION_H
10 #define HASHKIT_FUNCTION_H
11
12 #ifdef __cplusplus
13 extern "C" {
14 #endif
15
16 HASHKIT_API
17 uint32_t hashkit_generate_value(const hashkit_st *self, const char *key, size_t key_length);
18
19 /**
20 This sets/gets the default function we will be using.
21 */
22 HASHKIT_API
23 hashkit_return_t hashkit_set_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm);
24
25 HASHKIT_API
26 hashkit_return_t hashkit_set_custom_function(hashkit_st *hash, hashkit_hash_fn function, void *context);
27
28 HASHKIT_API
29 hashkit_hash_algorithm_t hashkit_get_function(const hashkit_st *hash);
30
31 /**
32 This sets/gets the function we use for distribution.
33 */
34 HASHKIT_API
35 hashkit_return_t hashkit_set_distribution_function(hashkit_st *hash, hashkit_hash_algorithm_t hash_algorithm);
36
37 HASHKIT_API
38 hashkit_return_t hashkit_set_custom_distribution_function(hashkit_st *self, hashkit_hash_fn function, void *context);
39
40 HASHKIT_API
41 hashkit_hash_algorithm_t hashkit_get_distribution_function(const hashkit_st *self);
42
43 /**
44 This is a utilitly function provided so that you can directly access hashes with a hashkit_st.
45 */
46
47 HASHKIT_API
48 uint32_t libhashkit_generate_value(const char *key, size_t key_length, hashkit_hash_algorithm_t hash_algorithm);
49
50 #ifdef __cplusplus
51 }
52 #endif
53
54 #endif /* HASHKIT_FUNCTION_H */