-
Notifications
You must be signed in to change notification settings - Fork 0
/
php_consistent_hashing.h
57 lines (48 loc) · 2.29 KB
/
php_consistent_hashing.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/* -*- Mode: C; tab-width: 4 -*- */
/*
+----------------------------------------------------------------------+
| PHP Version 5 |
+----------------------------------------------------------------------+
| Copyright (c) 1997-2009 The PHP Group |
+----------------------------------------------------------------------+
| This source file is subject to version 3.01 of the PHP license, |
| that is bundled with this package in the file LICENSE, and is |
| available through the world-wide-web at the following url: |
| http://www.php.net/license/3_01.txt |
| If you did not receive a copy of the PHP license and are unable to |
| obtain it through the world-wide-web, please send a note to |
| [email protected] so we can mail you a copy immediately. |
+----------------------------------------------------------------------+
| Author: Simon Effenberg <[email protected]> |
+----------------------------------------------------------------------+
*/
#ifndef PHP_CONSISTENT_HASHING_H
#define PHP_CONSISTENT_HASHING_H
#define PHP_CONSISTENT_HASHING_EXTNAME "Consistent_Hashing"
#define PHP_CONSISTENT_HASHING_EXTVER "0.1"
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "php.h"
#include "ext/standard/md5.h"
/* structures */
typedef struct point_target {
uint point;
char *target;
int target_len;
} PointTarget;
/* Methods */
PHP_METHOD(ConsistentHashing, __construct);
PHP_METHOD(ConsistentHashing, __destruct);
PHP_METHOD(ConsistentHashing, addTarget);
PHP_METHOD(ConsistentHashing, getTarget);
/* Internal methods */
PHPAPI int ht_target_init(char *target, int target_len, long weight TSRMLS_DC);
PHPAPI char * ht_find_target(zval *object, uint point);
PHPAPI uint ht_hash_object(char *object, int object_len);
PHPAPI int ht_get_array(zval *object, HashTable **array, char *name TSRMLS_DC);
static int ht_compare_targetpoints(void *a, void *b TSRMLS_DC);
static void ch_destructor_hashtables(zend_rsrc_list_entry * rsrc TSRMLS_DC);
extern zend_module_entry consistent_hashing_module_entry;
#define phpext_consistent_hashing_ptr &consistent_hashing_module_entry
#endif /* PHP_CONSISTENT_HASHING_H */