本文整理汇总了C++中ZHTClient::remove方法的典型用法代码示例。如果您正苦于以下问题:C++ ZHTClient::remove方法的具体用法?C++ ZHTClient::remove怎么用?C++ ZHTClient::remove使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ZHTClient
的用法示例。
在下文中一共展示了ZHTClient::remove方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: benchmarkRemove
float benchmarkRemove() {
double start = 0;
double end = 0;
start = TimeUtil::getTime_msec();
int errCount = 0;
int c = 0;
vector<string>::iterator it;
for (it = pkgList.begin(); it != pkgList.end(); it++) {
string result;
c++;
string pkg_str = *it;
Package pkg;
pkg.ParseFromString(pkg_str);
int ret = zc.remove(pkg.virtualpath());
if (ret < 0) {
errCount++;
}
}
end = TimeUtil::getTime_msec();
char buf[200];
sprintf(buf, "Removed packages, %d, %d, cost(ms), %f", numOfOps - errCount,
numOfOps, end - start);
cout << buf << endl;
return 0;
}
示例2: c_zht_remove_std
int c_zht_remove_std(ZHTClient_c zhtClient, const char *pair) {
ZHTClient * zhtcppClient = (ZHTClient *) zhtClient;
string str(pair);
return zhtcppClient->remove(str);
}
示例3: c_zht_remove2_std
int c_zht_remove2_std(ZHTClient_c zhtClient, const char *key) {
ZHTClient * zhtcppClient = (ZHTClient *) zhtClient;
string sKey(key);
Package package;
package.set_virtualpath(sKey);
package.set_operation(2); //1 for look up, 2 for remove, 3 for insert, 4 append
return zhtcppClient->remove(package.SerializeAsString());
}
示例4: c_zht_remove2
int c_zht_remove2(const char *key) {
string keyStr(key);
if (keyStr.empty()) //empty key not allowed.
return -1;
Package package;
package.set_virtualpath(keyStr);
package.set_operation(2); //1 for look up, 2 for remove, 3 for insert
return zhtClient.remove(package.SerializeAsString());
}
示例5: c_zht_remove_std
int c_zht_remove_std(ZHTClient_c zhtClient, const char *key) {
#ifdef IND_MUTEX
LockGuard lock(&c_zht_remove_mutex);
#elif SHARED_MUTEX
LockGuard lock(&c_zht_client_mutex);
#else
#endif
ZHTClient * zhtcppClient = (ZHTClient *) zhtClient;
string skey(key);
return zhtcppClient->remove(skey);
}
示例6: benchmarkRemove
float benchmarkRemove(vector<string> strList, ZHTClient &client) {
vector<string>::iterator it;
for (it = strList.begin(); it != strList.end(); it++) {
Package package;
package.ParseFromString((*it));
package.set_operation(2); // 3 for insert, 1 for look up, 2 for remove
package.set_replicano(5); //5: original, 3 not original
strList.erase(it);
string newStr = package.SerializeAsString();
strList.push_back(newStr);
}
double start = 0;
double end = 0;
start = getTime_msec();
int errCount = 0;
int c=0;
for (it = strList.begin(); it != strList.end(); it++) {
string result;
c++;
//cout <<"Remove count "<< c << endl;
//cout <<"Remove: "<< (*it).c_str() << endl;
if (client.remove((*it)) < 0) {
errCount++;
}
}
end = getTime_msec();
cout << "Remove " << strList.size() - errCount << " packages out of "
<< strList.size() << ", cost " << end - start << " ms" << endl;
return 0;
return 0;
}
示例7: c_zht_remove
int c_zht_remove(const char *pair) {
string str(pair);
return zhtClient.remove(str);
}