Updates to libhashkit.
[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 extern "C" {
15 #endif
16
17 typedef enum {
18 HASHKIT_SUCCESS,
19 HASHKIT_FAILURE,
20 HASHKIT_MEMORY_ALLOCATION_FAILURE,
21 HASHKIT_MAXIMUM_RETURN /* Always add new error code before */
22 } hashkit_return_t;
23
24 typedef enum {
25 HASHKIT_HASH_DEFAULT= 0, // hashkit_one_at_a_time()
26 HASHKIT_HASH_MD5,
27 HASHKIT_HASH_CRC,
28 HASHKIT_HASH_FNV1_64,
29 HASHKIT_HASH_FNV1A_64,
30 HASHKIT_HASH_FNV1_32,
31 HASHKIT_HASH_FNV1A_32,
32 HASHKIT_HASH_HSIEH,
33 HASHKIT_HASH_MURMUR,
34 HASHKIT_HASH_JENKINS,
35 HASHKIT_HASH_MAX
36 } hashkit_hash_algorithm_t;
37
38 /**
39 * Hash distributions that are available to use.
40 */
41 typedef enum
42 {
43 HASHKIT_DISTRIBUTION_MODULA,
44 HASHKIT_DISTRIBUTION_RANDOM,
45 HASHKIT_DISTRIBUTION_KETAMA,
46 HASHKIT_DISTRIBUTION_MAX /* Always add new values before this. */
47 } hashkit_distribution_t;
48
49
50 typedef struct hashkit_st hashkit_st;
51 typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length);
52
53 #ifdef __cplusplus
54 }
55 #endif
56
57 #endif /* HASHKIT_TYPES_H */