1
#ifndef DIRECTOR_HOST_H
2
#define DIRECTOR_HOST_H
12
/* name contains "ip:port" */
14
/* change commands each have originating host and originating sequence.
15
we'll keep track of the highest sequence we've seen from the host.
16
if we find a lower sequence, we've already handled the command and
17
it can be ignored (or: it must be ignored to avoid potential command
19
unsigned int last_seq;
20
/* Last time host was detected to be down/broken */
22
/* we are this director */
26
struct director_host *
27
director_host_add(struct director *dir, const struct ip_addr *ip,
29
void director_host_free(struct director_host *host);
31
struct director_host *
32
director_host_get(struct director *dir, const struct ip_addr *ip,
34
struct director_host *
35
director_host_lookup(struct director *dir, const struct ip_addr *ip,
37
struct director_host *
38
director_host_lookup_ip(struct director *dir, const struct ip_addr *ip);
40
/* Returns 0 if b1 equals b2.
41
-1 if b1 is closer to our left side than b2 or
42
-1 if b2 is closer to our right side than b1
44
int director_host_cmp_to_self(const struct director_host *b1,
45
const struct director_host *b2,
46
const struct director_host *self);
48
/* Parse hosts list (e.g. "host1:port host2 host3:port") and them as
50
void director_host_add_from_string(struct director *dir, const char *hosts);