2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* name contains "ip:port" */
0a53eb0283d7ec28c6105f61e118b96fce8ecb95Timo Sirainen /* change commands each have originating host and originating sequence.
0a53eb0283d7ec28c6105f61e118b96fce8ecb95Timo Sirainen we'll keep track of the highest sequence we've seen from the host.
0a53eb0283d7ec28c6105f61e118b96fce8ecb95Timo Sirainen if we find a lower sequence, we've already handled the command and
0a53eb0283d7ec28c6105f61e118b96fce8ecb95Timo Sirainen it can be ignored (or: it must be ignored to avoid potential command
468c28dfb03613ab8d487b5aebc985a969193aceTimo Sirainen /* use these to avoid infinitely sending SYNCs for directors that
468c28dfb03613ab8d487b5aebc985a969193aceTimo Sirainen aren't connected in the ring. */
468c28dfb03613ab8d487b5aebc985a969193aceTimo Sirainen unsigned int last_sync_seq, last_sync_seq_counter, last_sync_timestamp;
abe29107f5dce932d28a00912d2d75a01021bef1Timo Sirainen /* whenever we receive a SYNC with stale hosts_hash, set this. if it's
abe29107f5dce932d28a00912d2d75a01021bef1Timo Sirainen already set and equals the current hosts_hash, re-send our hosts to
abe29107f5dce932d28a00912d2d75a01021bef1Timo Sirainen everybody in case they somehow got out of sync. */
8c2b4a45f17a5cb13bb01058ca37798cf48d91baTimo Sirainen /* Last time host was detected to be down */
67cb14c7fb54a031818228522dc7255d5cd00f0aTimo Sirainen /* When we finish getting a right connection, send a SYNC with these
67cb14c7fb54a031818228522dc7255d5cd00f0aTimo Sirainen parameters (if delayed_sync_seq != 0) */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* we are this director */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainendirector_host_add(struct director *dir, const struct ip_addr *ip,
e4194f4703eeec32b432371ae30fc8f25ab720d8Timo Sirainenvoid director_host_free(struct director_host **host);
e4194f4703eeec32b432371ae30fc8f25ab720d8Timo Sirainenvoid director_host_ref(struct director_host *host);
e4194f4703eeec32b432371ae30fc8f25ab720d8Timo Sirainenvoid director_host_unref(struct director_host *host);
ce28adabf2c47d3af9ef197787cdb5139424c69cTimo Sirainenvoid director_host_restarted(struct director_host *host);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainendirector_host_get(struct director *dir, const struct ip_addr *ip,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainendirector_host_lookup(struct director *dir, const struct ip_addr *ip,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainendirector_host_lookup_ip(struct director *dir, const struct ip_addr *ip);
1055d8038122c4f4190d37d98fdff6791d1306f8Timo Sirainen/* Returns 0 if b1 equals b2.
1055d8038122c4f4190d37d98fdff6791d1306f8Timo Sirainen -1 if b1 is closer to our left side than b2 or
1055d8038122c4f4190d37d98fdff6791d1306f8Timo Sirainen -1 if b2 is closer to our right side than b1
1055d8038122c4f4190d37d98fdff6791d1306f8Timo Sirainen 1 vice versa */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint director_host_cmp_to_self(const struct director_host *b1,
6e54fd2bedbbc0c6316eae8fb569eb9a96aa29abTimo Sirainen/* Compare directors by IP/port. */
6e54fd2bedbbc0c6316eae8fb569eb9a96aa29abTimo Sirainenint director_host_cmp_p(struct director_host *const *host1,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Parse hosts list (e.g. "host1:port host2 host3:port") and them as
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid director_host_add_from_string(struct director *dir, const char *hosts);