#include <P_HostDBProcessor.h>
Inherits Continuation.
Data Structures | |
struct | Options |
Optional values for init . More... | |
Public Member Functions | |
int | probeEvent (int event, Event *e) |
int | clusterEvent (int event, Event *e) |
int | clusterResponseEvent (int event, Event *e) |
int | dnsEvent (int event, HostEnt *e) |
int | dnsPendingEvent (int event, Event *e) |
int | backgroundEvent (int event, Event *e) |
int | retryEvent (int event, Event *e) |
int | removeEvent (int event, Event *e) |
int | setbyEvent (int event, Event *e) |
void | refresh_MD5 () |
Recompute the MD5 and update ancillary values. | |
void | do_dns () |
bool | is_byname () |
bool | is_srv () |
HostDBInfo * | lookup_done (IpAddr const &ip, char const *aname, bool round_robin, unsigned int attl, SRVHosts *s=NULL) |
bool | do_get_response (Event *e) |
void | do_put_response (ClusterMachine *m, HostDBInfo *r, Continuation *cont) |
int | failed_cluster_request (Event *e) |
int | key_partition () |
void | remove_trigger_pending_dns () |
int | set_check_pending_dns () |
ClusterMachine * | master_machine (ClusterConfiguration *cc) |
HostDBInfo * | insert (unsigned int attl) |
void | init (HostDBMD5 const &md5, Options const &opt=DEFAULT_OPTIONS) |
int | make_get_message (char *buf, int len) |
int | make_put_message (HostDBInfo *r, Continuation *c, char *buf, int len) |
HostDBContinuation () | |
Data Fields | |
Action | action |
HostDBMD5 | md5 |
unsigned int | ttl |
HostResStyle | host_res_style |
Original IP address family style. | |
int | dns_lookup_timeout |
Event * | timeout |
ClusterMachine * | from |
Continuation * | from_cont |
HostDBApplicationInfo | app |
int | probe_depth |
ClusterMachine * | past_probes [CONFIGURATION_HISTORY_PROBE_DEPTH] |
char | md5_host_name_store [MAXDNAME+1] |
char | srv_target_name [MAXDNAME] |
void * | m_pDS |
Action * | pending_action |
unsigned int | missing:1 |
unsigned int | force_dns:1 |
unsigned int | round_robin:1 |
Static Public Attributes | |
static const Options | DEFAULT_OPTIONS |
Default defaults. |
Definition at line 438 of file P_HostDBProcessor.h.
HostDBContinuation::HostDBContinuation | ( | ) | [inline] |
Definition at line 521 of file P_HostDBProcessor.h.
References HostDBMD5::hash, probeEvent(), and SET_HANDLER.
int HostDBContinuation::backgroundEvent | ( | int | event, | |
Event * | e | |||
) |
Definition at line 2132 of file HostDB.cc.
References hostdb_current_interval.
Referenced by HostDBProcessor::start().
int HostDBContinuation::clusterEvent | ( | int | event, | |
Event * | e | |||
) |
Definition at line 1976 of file HostDB.cc.
References action, HostDBApplicationInfo::allotment, app, HostDBInfo::app, HostDBApplicationInfo::application_data_allotment::application1, HostDBApplicationInfo::application_data_allotment::application2, Action::cancel(), Action::cancelled, cluster_machine_at_depth(), Action::continuation, do_put_response(), Event::ethread, EVENT_HOST_DB_GET_RESPONSE, EVENT_INTERVAL, failed_cluster_request(), from, HostDBMD5::hash, HOST_DB_RETRY_PERIOD, HostDBMD5::host_name, hostdb_cont_free(), HOSTDB_INCREMENT_DYN_STAT, hostdb_migrate_on_demand, hostdb_total_hits_stat, ink_assert, HostDBMD5::ip, key_partition(), lookup_done(), master_hash(), md5, Action::mutex, MUTEX_TRY_LOCK_FOR, Queue< C, L >::remove(), reply_to_cont(), Event::schedule_in(), timeout, and ttl.
Referenced by do_get_response().
int HostDBContinuation::clusterResponseEvent | ( | int | event, | |
Event * | e | |||
) |
Definition at line 1939 of file HostDB.cc.
References action, Action::continuation, Event::ethread, EVENT_HOST_DB_GET_RESPONSE, from_cont, Continuation::handleEvent(), HOST_DB_RETRY_PERIOD, HostDBMD5::host_name, hostdb_cluster_round_robin, hostdb_cont_free(), ink_assert, HostDBMD5::ip, key_partition(), lookup_done(), missing, Action::mutex, Continuation::mutex, MUTEX_TRY_LOCK, round_robin, Event::schedule_in(), and ttl.
Referenced by put_hostinfo_ClusterFunction().
int HostDBContinuation::dnsEvent | ( | int | event, | |
HostEnt * | e | |||
) |
Definition at line 1372 of file HostDB.cc.
References IpAddr::_family, action, MultiCacheBase::alloc(), HostDBApplicationInfo::allotment, HostDBInfo::app, HostDBApplicationInfo::application_data_allotment::application1, HostDBApplicationInfo::application_data_allotment::application2, MultiCacheHeader::buckets, Action::cancel(), Action::cancelled, check_for_retry(), cluster_machine_at_depth(), Action::continuation, HostDBRoundRobin::current, HostDBInfo::data, HostDBMD5::db_mark, Debug, do_put_response(), HostEnt::ent, EVENT_HOST_DB_LOOKUP, EVENT_INTERVAL, fold_md5(), HostDBInfo::full, HostDBRoundRobin::good, Continuation::handleEvent(), HostDBMD5::hash, SRV::host, HOST_DB_MAX_ROUND_ROBIN_INFO, HOST_DB_RETRY_PERIOD, SRV::host_len, HostDBMD5::host_name, hostdb_cont_free(), hostdb_insert_timeout, SRVHosts::hosts, HRTIME_SECONDS, HostDBRoundRobin::info, ink_assert, HostDBInfo::ip, HostDBMD5::ip, ip_addr_set(), is_addr_valid(), is_byname(), HostDBInfo::is_srv, is_srv(), SRV::key, SRVInfo::key, HostDBRoundRobin::length, MultiCacheBase::lock_for_bucket(), lookup_done(), master_hash(), HostDBInfo::md5_high, HostDBInfo::md5_low, HostDBInfo::md5_low_low, memcpy, Action::mutex, MUTEX_RETRY_DELAY, MUTEX_TRY_LOCK_FOR, HostDBApplicationInfo::application_data_rr::offset, pending_action, SRV::port, SRV::priority, probe(), probeEvent(), refresh_MD5(), remove_trigger_pending_dns(), reply_to_cont(), restore_info(), HostDBInfo::reverse_dns, HostDBInfo::round_robin, HostDBApplicationInfo::rr, HostDBInfo::rr(), HostDBRoundRobin::rrcount, EThread::schedule_in(), SET_CONTINUATION_HANDLER, SET_HANDLER, HostDBRoundRobin::size(), skip(), HostDBInfo::srv, SRVHosts::srv_host_count, HostEnt::srv_hosts, SRVHosts::srv_hosts_length, SRVInfo::srv_offset, SRVInfo::srv_port, SRVInfo::srv_priority, SRVInfo::srv_weight, HostDBInfo::srvname(), this_ethread(), ProxyMutex::thread_holding, timeout, HostEnt::ttl, ttl, Warning, and SRV::weight.
Referenced by do_dns().
int HostDBContinuation::dnsPendingEvent | ( | int | event, | |
Event * | e | |||
) |
Definition at line 1326 of file HostDB.cc.
References action, MultiCacheHeader::buckets, Action::cancel(), Action::cancelled, Action::continuation, EVENT_HOST_DB_LOOKUP, EVENT_INTERVAL, eventProcessor, fold_md5(), Continuation::handleEvent(), HostDBMD5::hash, HOST_DB_RETRY_PERIOD, hostdb_cont_free(), ink_assert, MultiCacheBase::lock_for_bucket(), Action::mutex, MUTEX_TRY_LOCK_FOR, HostDBCache::pending_dns_for_hash(), probeEvent(), Queue< C, L >::remove(), EventProcessor::schedule_in(), SET_HANDLER, this_ethread(), ProxyMutex::thread_holding, and timeout.
Referenced by do_dns().
void HostDBContinuation::do_dns | ( | ) |
Definition at line 1892 of file HostDB.cc.
References action, Action::cancelled, Action::continuation, HostDBMD5::db_mark, Debug, HostDBMD5::dns_server, dnsEvent(), dnsPendingEvent(), dnsProcessor, DNSProcessor::gethostbyaddr(), DNSProcessor::gethostbyname(), DNSProcessor::getSRVbyname(), DNSProcessor::Options::handler, HOST_DB_MAX_TTL, HostDBMD5::host_name, DNSProcessor::Options::host_res_style, host_res_style_for(), hostdb_cont_free(), hostdb_lookup_timeout, HRTIME_SECONDS, ink_assert, HostDBMD5::ip, is_byname(), is_srv(), IpAddr::load(), lookup_done(), pending_action, reply_to_cont(), EThread::schedule_in(), set_check_pending_dns(), SET_HANDLER, ProxyMutex::thread_holding, DNSProcessor::Options::timeout, timeout, IpAddr::toString(), and DNSServer::x_dnsH.
Referenced by failed_cluster_request(), probe(), and probeEvent().
bool HostDBContinuation::do_get_response | ( | Event * | e | ) |
Definition at line 1672 of file HostDB.cc.
References cluster_machine_at_depth(), clusterEvent(), clusterProcessor, Queue< C, L >::enqueue(), HostDBMD5::hash, HOST_DB_CLUSTER_TIMEOUT, hostdb_cluster, hostdb_migrate_on_demand, ClusterProcessor::invoke_remote(), key_partition(), make_get_message(), master_hash(), past_probes, ClusterMachine::pop_ClusterHandler(), probe_depth, EThread::schedule_in(), SET_HANDLER, ProxyMutex::thread_holding, and timeout.
Referenced by failed_cluster_request(), and probeEvent().
void HostDBContinuation::do_put_response | ( | ClusterMachine * | m, | |
HostDBInfo * | r, | |||
Continuation * | cont | |||
) |
Definition at line 1771 of file HostDB.cc.
References clusterProcessor, hostdb_cluster, hostdb_cluster_round_robin, ClusterProcessor::invoke_remote(), make_put_message(), ClusterMachine::pop_ClusterHandler(), and HostDBInfo::round_robin.
Referenced by clusterEvent(), dnsEvent(), lookup_done(), and probeEvent().
int HostDBContinuation::failed_cluster_request | ( | Event * | e | ) |
Definition at line 2035 of file HostDB.cc.
References action, Action::cancelled, do_dns(), do_get_response(), and hostdb_cont_free().
Referenced by clusterEvent().
void HostDBContinuation::init | ( | HostDBMD5 const & | md5, | |
Options const & | opt = DEFAULT_OPTIONS | |||
) |
Definition at line 496 of file HostDB.cc.
References action, MultiCacheHeader::buckets, HostDBContinuation::Options::cont, dns_lookup_timeout, fold_md5(), HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, HostDBContinuation::Options::host_res_style, host_res_style, MultiCacheBase::lock_for_bucket(), md5, md5_host_name_store, memcpy, Action::mutex, Continuation::mutex, and HostDBContinuation::Options::timeout.
Referenced by get_hostinfo_ClusterFunction(), HostDBProcessor::getbyname_imm(), HostDBProcessor::getSRVbyname_imm(), probe(), put_hostinfo_ClusterFunction(), HostDBProcessor::setby(), and HostDBProcessor::setby_srv().
HostDBInfo * HostDBContinuation::insert | ( | unsigned int | attl | ) |
Definition at line 690 of file HostDB.cc.
References MultiCacheHeader::buckets, Debug, MultiCache< C >::delete_block(), fold_md5(), HostDBMD5::hash, HOST_DB_MAX_TTL, HostDBMD5::host_len, HostDBMD5::host_name, hostdb_current_interval, ink_assert, MultiCache< C >::insert_block(), HostDBInfo::ip_timeout_interval, HostDBInfo::ip_timestamp, MultiCacheBase::lock_for_bucket(), MultiCache< C >::lookup_block(), md5, HostDBInfo::md5_high, this_ethread(), and ProxyMutex::thread_holding.
Referenced by lookup_done().
bool HostDBContinuation::is_byname | ( | ) | [inline] |
Definition at line 481 of file P_HostDBProcessor.h.
References HostDBMD5::db_mark, and HOSTDB_MARK_IPV4.
Referenced by dnsEvent(), do_dns(), and lookup_done().
bool HostDBContinuation::is_srv | ( | ) | [inline] |
Definition at line 485 of file P_HostDBProcessor.h.
References HostDBMD5::db_mark.
Referenced by dnsEvent(), do_dns(), lookup_done(), and setbyEvent().
int HostDBContinuation::key_partition | ( | ) | [inline] |
Definition at line 555 of file P_HostDBProcessor.h.
References MultiCacheHeader::buckets, fold_md5(), HostDBMD5::hash, md5, and MultiCacheBase::partition_of_bucket().
Referenced by clusterEvent(), clusterResponseEvent(), and do_get_response().
HostDBInfo * HostDBContinuation::lookup_done | ( | IpAddr const & | ip, | |
char const * | aname, | |||
bool | round_robin, | |||
unsigned int | attl, | |||
SRVHosts * | s = NULL | |||
) |
Definition at line 1237 of file HostDB.cc.
References MultiCacheBase::alloc(), ats_ip_set(), MultiCacheHeader::buckets, HostDBInfo::data, Debug, MultiCache< C >::delete_block(), do_put_response(), fold_md5(), from, from_cont, HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, hostdb_ip_fail_timeout_interval, hostdb_ip_timeout_interval, HOSTDB_SUM_DYN_STAT, hostdb_ttl_mode, hostdb_ttl_stat, HostDBInfo::hostname_offset, ink_assert, ink_strlcpy(), insert(), HostDBInfo::ip, HostDBMD5::ip, is_byname(), HostDBInfo::is_srv, is_srv(), IpAddr::isValid(), MultiCacheBase::lock_for_bucket(), md5_host_name_store, HostDBInfo::reverse_dns, HostDBInfo::round_robin, HostDBInfo::set_failed(), HostDBInfo::srv, SRVHosts::srv_host_count, SRVInfo::srv_offset, this_ethread(), ProxyMutex::thread_holding, IpAddr::toString(), TTL_IGNORE, TTL_MAX, TTL_MIN, TTL_OBEY, and Warning.
Referenced by clusterEvent(), clusterResponseEvent(), dnsEvent(), and do_dns().
int HostDBContinuation::make_get_message | ( | char * | buf, | |
int | len | |||
) |
Definition at line 1650 of file HostDB.cc.
References ats_ip_set(), HostDB_get_message::cont, HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, ink_assert, ink_strlcpy(), HostDBMD5::ip, HostDB_get_message::ip, HostDB_get_message::md5, HostDB_get_message::name, HostDBMD5::port, and IpEndpoint::sa.
Referenced by do_get_response().
int HostDBContinuation::make_put_message | ( | HostDBInfo * | r, | |
Continuation * | c, | |||
char * | buf, | |||
int | len | |||
) |
Definition at line 1737 of file HostDB.cc.
References HostDBApplicationInfo::allotment, HostDBInfo::app, HostDBApplicationInfo::application_data_allotment::application1, HostDB_put_message::application1, HostDBApplicationInfo::application_data_allotment::application2, HostDB_put_message::application2, ats_ip_copy(), HostDB_put_message::cont, HostDBMD5::hash, HostDBMD5::host_len, HostDBMD5::host_name, ink_assert, ink_strlcpy(), HostDBInfo::ip, HostDB_put_message::ip, HostDBInfo::ip_time_remaining(), HostDB_put_message::md5, HostDB_put_message::missing, HostDB_put_message::name, HostDBInfo::round_robin, HostDB_put_message::round_robin, IpEndpoint::sa, and HostDB_put_message::ttl.
Referenced by do_put_response().
ClusterMachine * HostDBContinuation::master_machine | ( | ClusterConfiguration * | cc | ) |
Definition at line 2221 of file HostDB.cc.
References HostDBMD5::hash, and ClusterConfiguration::machine_hash().
int HostDBContinuation::probeEvent | ( | int | event, | |
Event * | e | |||
) |
Definition at line 1790 of file HostDB.cc.
References action, Action::cancelled, Action::continuation, do_dns(), do_get_response(), do_put_response(), Event::ethread, EVENT_HOST_DB_LOOKUP, force_dns, from, from_cont, Continuation::handleEvent(), HOST_DB_RETRY_PERIOD, HostDBMD5::host_name, hostdb_cont_free(), hostdb_enable, HOSTDB_INCREMENT_DYN_STAT, hostdb_total_hits_stat, ink_assert, HostDBMD5::ip, IpAddr::isValid(), Action::mutex, MUTEX_TRY_LOCK_FOR, probe(), reply_to_cont(), EThread::schedule_in(), this_ethread(), and ProxyMutex::thread_holding.
Referenced by dnsEvent(), dnsPendingEvent(), get_hostinfo_ClusterFunction(), HostDBProcessor::getbyname_imm(), HostDBProcessor::getSRVbyname_imm(), and HostDBContinuation().
void HostDBContinuation::refresh_MD5 | ( | ) |
Recompute the MD5 and update ancillary values.
Definition at line 522 of file HostDB.cc.
References MultiCacheHeader::buckets, fold_md5(), HostDBMD5::hash, MultiCacheBase::lock_for_bucket(), md5, Continuation::mutex, HostDBMD5::refresh(), and remove_trigger_pending_dns().
Referenced by dnsEvent().
void HostDBContinuation::remove_trigger_pending_dns | ( | ) |
Definition at line 1868 of file HostDB.cc.
References Debug, Queue< C, L >::dequeue(), Queue< C, L >::enqueue(), EVENT_IMMEDIATE, Continuation::handleEvent(), HostDBMD5::hash, DLL< C, L >::head, md5, HostDBCache::pending_dns_for_hash(), and Queue< C, L >::remove().
Referenced by dnsEvent(), and refresh_MD5().
int HostDBContinuation::removeEvent | ( | int | event, | |
Event * | e | |||
) |
Definition at line 1205 of file HostDB.cc.
References action, Action::cancelled, Action::continuation, Event::ethread, EVENT_HOST_DB_IP_REMOVED, Continuation::handleEvent(), HOST_DB_RETRY_PERIOD, HostDBMD5::host_name, hostdb_cont_free(), hostdb_enable, HostDBMD5::ip, Continuation::mutex, MUTEX_TRY_LOCK, probe(), remove_round_robin(), and Event::schedule_in().
int HostDBContinuation::retryEvent | ( | int | event, | |
Event * | e | |||
) |
int HostDBContinuation::set_check_pending_dns | ( | ) |
Definition at line 1851 of file HostDB.cc.
References Debug, Queue< C, L >::enqueue(), HostDBMD5::hash, DLL< C, L >::head, md5, and HostDBCache::pending_dns_for_hash().
Referenced by do_dns().
int HostDBContinuation::setbyEvent | ( | int | event, | |
Event * | e | |||
) |
Definition at line 1104 of file HostDB.cc.
References app, do_setby(), HostDBMD5::host_name, hostdb_cont_free(), HostDBMD5::ip, is_srv(), and probe().
Referenced by HostDBProcessor::setby(), and HostDBProcessor::setby_srv().
Definition at line 440 of file P_HostDBProcessor.h.
Referenced by clusterEvent(), clusterResponseEvent(), dnsEvent(), dnsPendingEvent(), do_dns(), failed_cluster_request(), get_hostinfo_ClusterFunction(), HostDBProcessor::getbyname_imm(), HostDBProcessor::getSRVbyname_imm(), hostdb_cont_free(), init(), probeEvent(), and removeEvent().
Definition at line 454 of file P_HostDBProcessor.h.
Referenced by clusterEvent(), HostDBProcessor::setby(), HostDBProcessor::setby_srv(), and setbyEvent().
HostDBContinuation::Options const HostDBContinuation::DEFAULT_OPTIONS [static] |
Default defaults.
Definition at line 515 of file P_HostDBProcessor.h.
Definition at line 449 of file P_HostDBProcessor.h.
Referenced by init().
unsigned int HostDBContinuation::force_dns |
Definition at line 465 of file P_HostDBProcessor.h.
Referenced by probeEvent().
Definition at line 452 of file P_HostDBProcessor.h.
Referenced by clusterEvent(), get_hostinfo_ClusterFunction(), lookup_done(), probeEvent(), and put_hostinfo_ClusterFunction().
Definition at line 453 of file P_HostDBProcessor.h.
Referenced by clusterResponseEvent(), get_hostinfo_ClusterFunction(), lookup_done(), probeEvent(), and put_hostinfo_ClusterFunction().
Original IP address family style.
Note this will disagree with md5.db_mark when doing a retry on an alternate family. The retry logic depends on it to avoid looping. Address family priority.
Definition at line 448 of file P_HostDBProcessor.h.
Referenced by init().
Definition at line 461 of file P_HostDBProcessor.h.
Definition at line 441 of file P_HostDBProcessor.h.
Referenced by clusterEvent(), init(), insert(), key_partition(), refresh_MD5(), remove_trigger_pending_dns(), and set_check_pending_dns().
char HostDBContinuation::md5_host_name_store[MAXDNAME+1] |
Definition at line 459 of file P_HostDBProcessor.h.
Referenced by init(), and lookup_done().
unsigned int HostDBContinuation::missing |
Definition at line 464 of file P_HostDBProcessor.h.
Referenced by clusterResponseEvent(), and put_hostinfo_ClusterFunction().
ClusterMachine* HostDBContinuation::past_probes[CONFIGURATION_HISTORY_PROBE_DEPTH] |
Definition at line 456 of file P_HostDBProcessor.h.
Referenced by do_get_response().
Definition at line 462 of file P_HostDBProcessor.h.
Referenced by dnsEvent(), do_dns(), and hostdb_cont_free().
Definition at line 455 of file P_HostDBProcessor.h.
Referenced by do_get_response().
unsigned int HostDBContinuation::round_robin |
Definition at line 466 of file P_HostDBProcessor.h.
Referenced by clusterResponseEvent(), and put_hostinfo_ClusterFunction().
char HostDBContinuation::srv_target_name[MAXDNAME] |
Definition at line 460 of file P_HostDBProcessor.h.
Referenced by HostDBProcessor::setby_srv().
Definition at line 451 of file P_HostDBProcessor.h.
Referenced by clusterEvent(), dnsEvent(), dnsPendingEvent(), do_dns(), and do_get_response().
unsigned int HostDBContinuation::ttl |
Definition at line 443 of file P_HostDBProcessor.h.
Referenced by clusterEvent(), clusterResponseEvent(), dnsEvent(), and put_hostinfo_ClusterFunction().