Exemple #1
0
RepoStatus Repo::insertUnit(UnitEmitter* ue, UnitOrigin unitOrigin,
                            RepoTxn& txn) {
  if (insertMd5(unitOrigin, ue, txn) == RepoStatus::error ||
      ue->insert(unitOrigin, txn) == RepoStatus::error) {
    return RepoStatus::error;
  }
  return RepoStatus::success;
}
Exemple #2
0
bool Repo::insertUnit(UnitEmitter* ue, UnitOrigin unitOrigin, RepoTxn& txn) {
  try {
    if (insertMd5(unitOrigin, ue, txn)) return true;
    if (ue->insert(unitOrigin, txn)) return true;
  } catch (const std::exception& e) {
    TRACE(0, "unexpected exception in insertUnit: %s\n",
             e.what());
    assert(false);
    return true;
  }
  return false;
}
Exemple #3
0
void Repo::commitMd5(UnitOrigin unitOrigin, UnitEmitter* ue) {
  try {
    RepoTxn txn(*this);
    bool err = insertMd5(unitOrigin, ue, txn);
    if (!err) {
      txn.commit();
    }
  } catch(RepoExc& re) {
    int repoId = repoIdForNewUnit(unitOrigin);
    if (repoId != RepoIdInvalid) {
      TRACE(3, "Failed to commit md5 for '%s' to '%s': %s\n",
               ue->m_filepath->data(), repoName(repoId).c_str(),
               re.msg().c_str());
    }
  }
}