| 163 | } |
| 164 | |
| 165 | CDBEnv::VerifyResult CDBEnv::Verify(std::string strFile, bool (*recoverFunc)(CDBEnv& dbenv, std::string strFile)) |
| 166 | { |
| 167 | LOCK(cs_db); |
| 168 | assert(mapFileUseCount.count(strFile) == 0); |
| 169 | |
| 170 | Db db(dbenv, 0); |
| 171 | int result = db.verify(strFile.c_str(), NULL, NULL, 0); |
| 172 | if (result == 0) |
| 173 | return VERIFY_OK; |
| 174 | else if (recoverFunc == NULL) |
| 175 | return RECOVER_FAIL; |
| 176 | |
| 177 | // Try to recover: |
| 178 | bool fRecovered = (*recoverFunc)(*this, strFile); |
| 179 | return (fRecovered ? RECOVER_OK : RECOVER_FAIL); |
| 180 | } |
| 181 | |
| 182 | bool CDBEnv::Salvage(std::string strFile, bool fAggressive, std::vector<CDBEnv::KeyValPair>& vResult) |
| 183 | { |