Updates for libmemached to use 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_CUSTOM,
36 HASHKIT_HASH_MAX
37 } hashkit_hash_algorithm_t;
38
39 /**
40 * Hash distributions that are available to use.
41 */
42 typedef enum
43 {
44 HASHKIT_DISTRIBUTION_MODULA,
45 HASHKIT_DISTRIBUTION_RANDOM,
46 HASHKIT_DISTRIBUTION_KETAMA,
47 HASHKIT_DISTRIBUTION_MAX /* Always add new values before this. */
48 } hashkit_distribution_t;
49
50
51 typedef struct hashkit_st hashkit_st;
52 typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length, void *context);
53
54 #ifdef __cplusplus
55 }
56 #endif
57
58 #endif /* HASHKIT_TYPES_H */