本文整理汇总了C++中SharedRefPtr::address方法的典型用法代码示例。如果您正苦于以下问题:C++ SharedRefPtr::address方法的具体用法?C++ SharedRefPtr::address怎么用?C++ SharedRefPtr::address使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SharedRefPtr
的用法示例。
在下文中一共展示了SharedRefPtr::address方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: on_remove
void Session::on_remove(SharedRefPtr<Host> host) {
load_balancing_policy_->on_remove(host);
{ // Lock hosts
ScopedMutex l(&hosts_mutex_);
hosts_.erase(host->address());
}
for (IOWorkerVec::iterator it = io_workers_.begin(),
end = io_workers_.end(); it != end; ++it) {
(*it)->remove_pool_async(host->address(), true);
}
}
示例2: is_valid_host
bool BlacklistPolicy::is_valid_host(const SharedRefPtr<Host>& host) const {
const std::string& host_address = host->address().to_string(false);
for (ContactPointList::const_iterator it = hosts_.begin(),
end = hosts_.end();
it != end; ++it) {
if (host_address.compare(*it) == 0) {
return false;
}
}
return true;
}
示例3: on_up
void Session::on_up(SharedRefPtr<Host> host) {
host->set_up();
if (load_balancing_policy_->distance(host) == CASS_HOST_DISTANCE_IGNORE) {
return;
}
load_balancing_policy_->on_up(host);
for (IOWorkerVec::iterator it = io_workers_.begin(),
end = io_workers_.end(); it != end; ++it) {
(*it)->add_pool_async(host->address(), false);
}
}
示例4: on_down
void Session::on_down(SharedRefPtr<Host> host) {
host->set_down();
load_balancing_policy_->on_down(host);
bool cancel_reconnect = false;
if (load_balancing_policy_->distance(host) == CASS_HOST_DISTANCE_IGNORE) {
// This permanently removes a host from all IO workers by stopping
// any attempt to reconnect to that host.
cancel_reconnect = true;
}
for (IOWorkerVec::iterator it = io_workers_.begin(),
end = io_workers_.end(); it != end; ++it) {
(*it)->remove_pool_async(host->address(), cancel_reconnect);
}
}
示例5: distance
CassHostDistance DCAwarePolicy::distance(const SharedRefPtr<Host>& host) const {
if (local_dc_.empty() || host->dc() == local_dc_) {
return CASS_HOST_DISTANCE_LOCAL;
}
const CopyOnWriteHostVec& hosts = per_remote_dc_live_hosts_.get_hosts(host->dc());
size_t num_hosts = std::min(hosts->size(), used_hosts_per_remote_dc_);
for (size_t i = 0; i < num_hosts; ++i) {
if ((*hosts)[i]->address() == host->address()) {
return CASS_HOST_DISTANCE_REMOTE;
}
}
return CASS_HOST_DISTANCE_IGNORE;
}
示例6: on_add
void Session::on_add(SharedRefPtr<Host> host, bool is_initial_connection) {
host->set_up();
if (load_balancing_policy_->distance(host) == CASS_HOST_DISTANCE_IGNORE) {
return;
}
if (is_initial_connection) {
pending_pool_count_ += io_workers_.size();
} else {
load_balancing_policy_->on_add(host);
}
for (IOWorkerVec::iterator it = io_workers_.begin(),
end = io_workers_.end(); it != end; ++it) {
(*it)->add_pool_async(host->address(), is_initial_connection);
}
}
示例7: while
SharedRefPtr<Host> TokenAwarePolicy::TokenAwareQueryPlan::compute_next() {
while (remaining_ > 0) {
--remaining_;
const SharedRefPtr<Host>& host((*replicas_)[index_++ % replicas_->size()]);
if (host->is_up() && child_policy_->distance(host) == CASS_HOST_DISTANCE_LOCAL) {
return host;
}
}
SharedRefPtr<Host> host;
while ((host = child_plan_->compute_next())) {
if (!contains(replicas_, host->address()) ||
child_policy_->distance(host) != CASS_HOST_DISTANCE_LOCAL) {
return host;
}
}
return SharedRefPtr<Host>();
}