| 320 | } |
| 321 | |
| 322 | std::optional<std::string> CDBWrapper::ReadImpl(std::span<const std::byte> key) const |
| 323 | { |
| 324 | leveldb::Slice slKey(CharCast(key.data()), key.size()); |
| 325 | std::string strValue; |
| 326 | leveldb::Status status = DBContext().pdb->Get(DBContext().readoptions, slKey, &strValue); |
| 327 | if (!status.ok()) { |
| 328 | if (status.IsNotFound()) |
| 329 | return std::nullopt; |
| 330 | LogError("LevelDB read failure: %s", status.ToString()); |
| 331 | HandleError(status); |
| 332 | } |
| 333 | return strValue; |
| 334 | } |
| 335 | |
| 336 | bool CDBWrapper::ExistsImpl(std::span<const std::byte> key) const |
| 337 | { |