director.h revision aa797403d51ff047727b77d64532001d6b6cc21a
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainentypedef void director_state_change_callback_t(struct director *dir);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* IP and port of this director. self_host->ip/port must equal these. */
0a53eb0283d7ec28c6105f61e118b96fce8ecb95Timo Sirainen /* all director connections */
edd318d5866ac3fbc6e8df28fb24a4dfef93c884Timo Sirainen /* current mail hosts */
edd318d5866ac3fbc6e8df28fb24a4dfef93c884Timo Sirainen /* original mail hosts configured in config file.
edd318d5866ac3fbc6e8df28fb24a4dfef93c884Timo Sirainen this is used only for doveadm lookups */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* temporary user -> host associations */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* these requests are waiting for directors to be in synced */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ARRAY_DEFINE(pending_requests, struct director_request *);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen director_state_change_callback_t *state_change_callback;
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* director hosts are sorted by IP (and port) */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen ARRAY_DEFINE(dir_hosts, struct director_host *);
aa797403d51ff047727b77d64532001d6b6cc21aTimo Sirainen /* the lowest minor version supported by the ring */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen /* director ring handshaking is complete.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen director can start serving clients. */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Create a new director. If listen_ip specifies an actual IP, it's used with
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen listen_port for finding ourself from the director_servers setting.
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen listen_port is used regardless by director_host_add_from_string() for hosts
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen without specified port. */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainendirector_init(const struct director_settings *set,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const struct ip_addr *listen_ip, unsigned int listen_port,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Start connecting to other directors */
4aab01f4eade3d278b61471516c062ce30a84b5fTimo Sirainenvoid director_set_ring_handshaked(struct director *dir);
0a53eb0283d7ec28c6105f61e118b96fce8ecb95Timo Sirainenvoid director_set_ring_synced(struct director *dir);
152db3f90f298b7fb2dbbd4276f0fc30a9bc30f6Timo Sirainenvoid director_set_ring_unsynced(struct director *dir);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid director_set_state_changed(struct director *dir);
aa797403d51ff047727b77d64532001d6b6cc21aTimo Sirainenvoid director_sync_send(struct director *dir, struct director_host *host,
433f5c9cc560a8cbff47257513d0bacb1cf250f4Timo Sirainenbool director_resend_sync(struct director *dir);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid director_update_host(struct director *dir, struct director_host *src,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid director_remove_host(struct director *dir, struct director_host *src,
5e9bb72de1209cd39fdf3e95bdb26e047cc5594eTimo Sirainenvoid director_flush_host(struct director *dir, struct director_host *src,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid director_update_user(struct director *dir, struct director_host *src,
15ab2452b0220a115f4351ad9d7fd5ec70ae7966Timo Sirainenvoid director_move_user(struct director *dir, struct director_host *src,
15ab2452b0220a115f4351ad9d7fd5ec70ae7966Timo Sirainen unsigned int username_hash, struct mail_host *host);
15ab2452b0220a115f4351ad9d7fd5ec70ae7966Timo Sirainenvoid director_user_killed(struct director *dir, unsigned int username_hash);
15ab2452b0220a115f4351ad9d7fd5ec70ae7966Timo Sirainenvoid director_user_killed_everywhere(struct director *dir,
0a53eb0283d7ec28c6105f61e118b96fce8ecb95Timo Sirainenvoid director_sync_freeze(struct director *dir);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen/* Send data to all directors using both left and right connections
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen (unless they're the same). */
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenvoid director_update_send(struct director *dir, struct director_host *src,
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainen const char *data);
2670cd577aa57eb9f915a4f4220ae48c9b4fc5fbTimo Sirainenint director_connect_host(struct director *dir, struct director_host *host);