本文整理汇总了C++中DBClientConnection::setRequestMetadataWriter方法的典型用法代码示例。如果您正苦于以下问题:C++ DBClientConnection::setRequestMetadataWriter方法的具体用法?C++ DBClientConnection::setRequestMetadataWriter怎么用?C++ DBClientConnection::setRequestMetadataWriter使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DBClientConnection
的用法示例。
在下文中一共展示了DBClientConnection::setRequestMetadataWriter方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _connect
void SyncClusterConnection::_connect(const std::string& hostStr) {
log() << "SyncClusterConnection connecting to [" << hostStr << "]" << endl;
const HostAndPort host(hostStr);
DBClientConnection* c;
if (connectionHook) {
c = new DBClientConnection(
true, // auto reconnect
0, // socket timeout
[this, host](const executor::RemoteCommandResponse& isMasterReply) {
return connectionHook(host, isMasterReply);
});
} else {
c = new DBClientConnection(true);
}
c->setRequestMetadataWriter(getRequestMetadataWriter());
c->setReplyMetadataReader(getReplyMetadataReader());
c->setSoTimeout(_socketTimeout);
Status status = c->connect(host);
if (!status.isOK()) {
log() << "SyncClusterConnection connect fail to: " << hostStr << causedBy(status);
if (status == ErrorCodes::IncompatibleCatalogManager) {
// Make sure to propagate IncompatibleCatalogManager errors to trigger catalog manager
// swapping.
uassertStatusOK(status);
}
}
_connAddresses.push_back(hostStr);
_conns.push_back(c);
}
示例2: _connect
void SyncClusterConnection::_connect(const std::string& host) {
log() << "SyncClusterConnection connecting to [" << host << "]" << endl;
DBClientConnection* c = new DBClientConnection(true);
c->setRequestMetadataWriter(getRequestMetadataWriter());
c->setReplyMetadataReader(getReplyMetadataReader());
c->setSoTimeout(_socketTimeout);
string errmsg;
if (!c->connect(HostAndPort(host), errmsg))
log() << "SyncClusterConnection connect fail to: " << host << " errmsg: " << errmsg << endl;
_connAddresses.push_back(host);
_conns.push_back(c);
}