#ifndef DIRECTOR_HOST_H
#define DIRECTOR_HOST_H
#include "net.h"
struct director;
struct director_host {
int refcount;
char *ip_str;
/* name contains "ip:port" */
char *name;
/* change commands each have originating host and originating sequence.
we'll keep track of the highest sequence we've seen from the host.
if we find a lower sequence, we've already handled the command and
it can be ignored (or: it must be ignored to avoid potential command
loops) */
unsigned int last_seq;
/* use these to avoid infinitely sending SYNCs for directors that
aren't connected in the ring. */
/* whenever we receive a SYNC with stale hosts_hash, set this. if it's
already set and equals the current hosts_hash, re-send our hosts to
everybody in case they somehow got out of sync. */
unsigned int desynced_hosts_hash;
/* Last time host was detected to be down */
/* When we finish getting a right connection, send a SYNC with these
parameters (if delayed_sync_seq != 0) */
unsigned int delayed_sync_minor_version;
unsigned int delayed_sync_timestamp;
unsigned int delayed_sync_hosts_hash;
/* we are this director */
};
struct director_host *
struct director_host *
struct director_host *
struct director_host *
/* Returns 0 if b1 equals b2.
-1 if b1 is closer to our left side than b2 or
-1 if b2 is closer to our right side than b1
1 vice versa */
const struct director_host *b2,
const struct director_host *self);
struct director_host *const *host2);
/* Parse hosts list (e.g. "host1:port host2 host3:port") and them as
directors */
#endif