本文整理汇总了C++中Director::rootBucket方法的典型用法代码示例。如果您正苦于以下问题:C++ Director::rootBucket方法的具体用法?C++ Director::rootBucket怎么用?C++ Director::rootBucket使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Director
的用法示例。
在下文中一共展示了Director::rootBucket方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: balance
void DirectorPlugin::balance(HttpRequest* r, const std::string& directorName,
const std::string& bucketName) {
auto i = directors_.find(directorName);
if (i == directors_.end()) {
r->log(Severity::error,
"director.balance(): No director with name '%s' configured.",
directorName.c_str());
internalServerError(r);
return;
}
Director* director = i->second.get();
RequestShaper::Node* bucket = nullptr;
if (!bucketName.empty()) {
bucket = director->findBucket(bucketName);
if (!bucket) {
// explicit bucket specified, but not found -> ignore.
bucket = director->rootBucket();
r->log(Severity::error,
"director: Requested bucket '%s' not found in director '%s'. "
"Assigning root bucket.",
bucketName.c_str(), directorName.c_str());
}
} else {
bucket = director->rootBucket();
}
auto rn = requestNotes(r);
rn->manager = director;
r->onPostProcess.connect(std::bind(&DirectorPlugin::addVia, this, r));
#if !defined(NDEBUG)
server().log(Severity::trace, "director: passing request to %s [%s].",
director->name().c_str(), bucket->name().c_str());
#endif
director->schedule(rn, bucket);
} // }}}