diff options
author | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-05-08 19:05:30 +0400 |
---|---|---|
committer | Vsevolod Stakhov <vsevolod@rambler-co.ru> | 2008-05-08 19:05:30 +0400 |
commit | 70c78281e3957bdbaa1204e40f2419a4a1918eb7 (patch) | |
tree | 29720ef474513c582f8d1faa855b2e81c5e1d3ae /upstream.h | |
download | rspamd-70c78281e3957bdbaa1204e40f2419a4a1918eb7.tar.gz rspamd-70c78281e3957bdbaa1204e40f2419a4a1918eb7.zip |
* Add skeleton
Diffstat (limited to 'upstream.h')
-rw-r--r-- | upstream.h | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/upstream.h b/upstream.h new file mode 100644 index 000000000..ad2ac4f4b --- /dev/null +++ b/upstream.h @@ -0,0 +1,43 @@ +#ifndef UPSTREAM_H +#define UPSTREAM_H + +#include <sys/types.h> + + +struct upstream { + unsigned int errors; + time_t time; + unsigned char dead; + unsigned char priority; + int16_t weight; + uint32_t *ketama_points; + size_t ketama_points_size; +}; + +void upstream_fail (struct upstream *up, time_t now); +void upstream_ok (struct upstream *up, time_t now); +void revive_all_upstreams (void *ups, size_t members, size_t msize); +int upstream_ketama_add (struct upstream *up, char *up_key, size_t keylen, size_t keypoints); + +struct upstream* get_random_upstream (void *ups, size_t members, size_t msize, + time_t now, time_t error_timeout, + time_t revive_timeout, size_t max_errors); + +struct upstream* get_upstream_by_hash (void *ups, size_t members, size_t msize, + time_t now, time_t error_timeout, + time_t revive_timeout, size_t max_errors, + char *key, size_t keylen); + +struct upstream* get_upstream_round_robin (void *ups, size_t members, size_t msize, + time_t now, time_t error_timeout, + time_t revive_timeout, size_t max_errors); + +struct upstream* get_upstream_by_hash_ketama (void *ups, size_t members, size_t msize, time_t now, + time_t error_timeout, time_t revive_timeout, size_t max_errors, + char *key, size_t keylen); + + +#endif /* UPSTREAM_H */ +/* + * vi:ts=4 + */ |