Check for failures while configuring client.
[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_INVALID_HASH,
23 HASHKIT_INVALID_ARGUMENT,
24 HASHKIT_MAXIMUM_RETURN /* Always add new error code before */
25 } hashkit_return_t;
26
27 typedef enum {
28 HASHKIT_HASH_DEFAULT= 0, // hashkit_one_at_a_time()
29 HASHKIT_HASH_MD5,
30 HASHKIT_HASH_CRC,
31 HASHKIT_HASH_FNV1_64,
32 HASHKIT_HASH_FNV1A_64,
33 HASHKIT_HASH_FNV1_32,
34 HASHKIT_HASH_FNV1A_32,
35 HASHKIT_HASH_HSIEH,
36 HASHKIT_HASH_MURMUR,
37 HASHKIT_HASH_JENKINS,
38 HASHKIT_HASH_CUSTOM,
39 HASHKIT_HASH_MAX
40 } hashkit_hash_algorithm_t;
41
42 /**
43 * Hash distributions that are available to use.
44 */
45 typedef enum
46 {
47 HASHKIT_DISTRIBUTION_MODULA,
48 HASHKIT_DISTRIBUTION_RANDOM,
49 HASHKIT_DISTRIBUTION_KETAMA,
50 HASHKIT_DISTRIBUTION_MAX /* Always add new values before this. */
51 } hashkit_distribution_t;
52
53
54 typedef struct hashkit_st hashkit_st;
55
56 typedef uint32_t (*hashkit_hash_fn)(const char *key, size_t key_length, void *context);
57
58 #ifdef __cplusplus
59 }
60 #endif
61
62 #endif /* HASHKIT_TYPES_H */