filesystem::touch(p);
}
- bool RepoManager::checkIfToRefreshMetadata( const RepoInfo &info,
+ RepoManager::RefreshCheckStatus RepoManager::checkIfToRefreshMetadata(
+ const RepoInfo &info,
const Url &url,
RawMetadataRefreshPolicy policy )
{
<< "' has been refreshed less than repo.refresh.delay ("
<< ZConfig::instance().repo_refresh_delay()
<< ") minutes ago. Advising to skip refresh" << endl;
- return false;
+ return REPO_DELAYED;
}
}
if (!refresh)
touchIndexFile(info);
- return refresh;
+ return refresh ? REFRESH_NEEDED : REPO_UP_TO_DATE;
}
#if 0
else if ( repokind.toEnum() == RepoType::RPMPLAINDIR_e )
ZYPP_RETHROW(e);
}
- return true; // default
+ return REFRESH_NEEDED; // default
}
void RepoManager::refreshMetadata( const RepoInfo &info,
// check whether to refresh metadata
// if the check fails for this url, it throws, so another url will be checked
- if (!checkIfToRefreshMetadata(info, url, policy))
+ if (checkIfToRefreshMetadata(info, url, policy)!=REFRESH_NEEDED)
return;
MIL << "Going to refresh metadata from " << url << endl;
RepoStatus metadataStatus( const RepoInfo &info ) const;
/**
+ * Possibly return state of checkIfRefreshMEtadata function
+ */
+ enum RefreshCheckStatus {
+ REFRESH_NEEDED, /**< refresh is needed */
+ REPO_UP_TO_DATE, /**< repository not changed */
+ REPO_DELAYED /**< refresh is delayed due to settings */
+ };
+
+ /**
* Checks whether to refresh metadata for specified repository and url.
* <p>
* The need for refresh is evaluated according to the following conditions,
* {
* // check whether to refresh metadata
* // if the check fails for this url, it throws, so another url will be checked
- * if (!checkIfToRefreshMetadata(info, *it, policy))
+ * if (checkIfToRefreshMetadata(info, *it, policy)!=RepoInfo::REFRESH_NEEDED)
* return;
*
* // do the actual refresh
* \param info
* \param url
* \param policy
+ * \return state of repository
+ * \see RefreshCheckStatus
* \throws RepoUnknownTypeException
* \throws repo::RepoNoAliasException if can't figure an alias
* \throws Exception on unknown error
*
*/
- bool checkIfToRefreshMetadata( const RepoInfo &info,
+ RefreshCheckStatus checkIfToRefreshMetadata( const RepoInfo &info,
const Url &url,
RawMetadataRefreshPolicy policy = RefreshIfNeeded);