Modified Hashkit class (turned it into an actual class).
[awesomized/libmemcached] / libhashkit / types.h
1
2 /* HashKit
3 * Copyright (C) 2009 Brian Aker
4 * All rights reserved.
5 *
6 * Use and distribution licensed under the BSD license. See
7 * the COPYING file in the parent directory for full text.
8 */
9
10 #ifndef HASHKIT_TYPES_H
11 #define HASHKIT_TYPES_H
12
13 #ifdef __cplusplus
14
15 extern "C" {
16 #endif
17
18 typedef enum {
19 HASHKIT_SUCCESS,
20 HASHKIT_FAILURE,
21 HASHKIT_MEMORY_ALLOCATION_FAILURE,
22 HASHKIT_MAXIMUM_RETURN /* Always add new error code before */
23 } hashkit_return_t;
24
25 typedef enum {
26 HASHKIT_HASH_DEFAULT= 0, // hashkit_one_at_a_time()
27 HASHKIT_HASH_MD5,
28 HASHKIT_HASH_CRC,
29 HASHKIT_HASH_FNV1_64,
30 HASHKIT_HASH_FNV1A_64,
31 HASHKIT_HASH_FNV1_32,
32 HASHKIT_HASH_FNV1A_32,
33 HASHKIT_HASH_HSIEH,
34 HASHKIT_HASH_MURMUR,
35 HASHKIT_HASH_JENKINS,
36 HASHKIT_HASH_CUSTOM,
37 HASHKIT_HASH_MAX
38 } hashkit_hash_algorithm_t;
39
40 /**
41 * Hash distributions that are available to use.
42 */
43 typedef enum
44 {
45 HASHKIT_DISTRIBUTION_MODULA,
46 HASHKIT_DISTRIBUTION_RANDOM,
47 HASHKIT_DISTRIBUTION_KETAMA,
48 HASHKIT_DISTRIBUTION_MAX /* Always add new values before this. */
49 } hashkit_distribution_t;
50
51
52 typedef struct hashkit_st hashkit_st;
53
54 typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length, void *context);
55
56 #ifdef __cplusplus
57 }
58 #endif
59
60 #endif /* HASHKIT_TYPES_H */