本文整理汇总了C++中DataObjectRef::isPersistent方法的典型用法代码示例。如果您正苦于以下问题:C++ DataObjectRef::isPersistent方法的具体用法?C++ DataObjectRef::isPersistent怎么用?C++ DataObjectRef::isPersistent使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DataObjectRef
的用法示例。
在下文中一共展示了DataObjectRef::isPersistent方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1:
// We intercept the `handleVerifiedDataObject` call to now call
// into the cache strat, if it exists. The cache strat module
// will then call `insertDataObjectIntoDataStore` if the new object
// should be inserted
void
DataManager::insertDataObjectIntoDataStore(DataObjectRef& dObj)
{
if (!dObj) {
HAGGLE_ERR ("Trying to insert null data object into DB.\n");
return;
}
// insert into database (including filtering)
if (dObj->isPersistent ()) {
kernel->getDataStore ()->insertDataObject (dObj,
onInsertedDataObjectCallback);
}
else {
// do not expect a callback for a non-persistent data object,
// but we still call insertDataObject in order to filter the data object.
kernel->getDataStore ()->insertDataObject (dObj, NULL);
}
}
示例2: string
/*
* Returns true iff
*/
bool
CacheStrategyUtility::isResponsibleForDataObject(
DataObjectRef &dObj)
{
string id = string(dObj->getIdStr());
/*
// THIS IS NOT THREAD SAFE!! added getOrigSize
// to grab unaltered file size.
if (utilMetadata.find(id) != utilMetadata.end()) {
return true;
}
*/
if (dObj->isDuplicate()) {
return false;
}
// SW: TODO: NOTE: this might not be the best way to check if it's from
// a local application, but it works for now...
bool isLocal = dObj->getRemoteInterface() && dObj->getRemoteInterface()->isApplication();
bool notResponsible = dObj->isControlMessage() || dObj->isNodeDescription();
bool isResponsible = !notResponsible;
if (!handle_zero_size) {
isResponsible = isResponsible && (dObj->getOrigDataLen() > 0);
}
if (!manage_locally_sent_files) {
isResponsible = isResponsible && dObj->isPersistent();
}
if (stats_replacement_strat && stats_replacement_strat->isResponsibleForDataObject(dObj)) {
isResponsible = true;
} else if (manage_only_remote_files) {
isResponsible = isResponsible && !isLocal;
}
return isResponsible;
}